s07aa returns the value of the circular tangent, .
Syntax
C# |
---|
public static double s07aa( double x, out int ifail ) |
Visual Basic |
---|
Public Shared Function s07aa ( _ x As Double, _ <OutAttribute> ByRef ifail As Integer _ ) As Double |
Visual C++ |
---|
public: static double s07aa( double x, [OutAttribute] int% ifail ) |
F# |
---|
static member s07aa : x : float * ifail : int byref -> float |
Parameters
- x
- Type: System..::..DoubleOn entry: the argument of the function.
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Return Value
s07aa returns the value of the circular tangent, .
Description
s07aa calculates an approximate value for the circular tangent of its argument, . It is based on the Chebyshev expansion
where and .
The reduction to the standard range is accomplished by taking
where is an integer and ,
i.e., where .
From the properties of it follows that
References
Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Error Indicators and Warnings
Errors or warnings detected by the method:
- The method has been called with an argument that is larger in magnitude than ; the default result returned is zero. The value of is given in the Users' Note for your implementation.
- The method has been called with an argument that is too close (as determined using the relative tolerance ) to an odd multiple of , at which the function is infinite; the method returns a value with the correct sign but a more or less arbitrary but large magnitude (see [Accuracy]). The value of is given in the Users' Note for your implementation.
Accuracy
If and are the relative errors in the argument and result respectively, then in principle
That is a relative error in the argument, , is amplified by at least a factor in the result.
Similarly if is the absolute error in the result this is given by
The equalities should hold if is greater than the machine precision ( is a result of data errors etc.) but if is simply the round-off error in the machine it is possible that internal calculation rounding will lose an extra figure.
In the principal range it is possible to preserve relative accuracy even near the zero of at but at the other zeros only absolute accuracy is possible. Near the infinities of both the relative and absolute errors become infinite and the method must fail (error ).
If is odd and the method could not return better than two figures and in all probability would produce a result that was in error in its most significant figure. Therefore the method fails and it returns the value
which is the value of the tangent at the nearest argument for which a valid call could be made.
Accuracy is also unavoidably lost if the method is called with a large argument. If the method fails (error ) and returns zero. (See the Users' Note for your implementation for specific values of and .)
Parallelism and Performance
None.
Further Comments
None.
Example
This example reads values of the argument from a file, evaluates the function at each value of and prints the results.
Example program (C#): s07aae.cs