Public Shared Function s07aa ( _ x As Double, _ <OutAttribute> ByRef ifail As Integer _ ) As Double
public: static double s07aa( double x, [OutAttribute] int% ifail )
- Type: System..::..DoubleOn entry: the argument of the function.
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
Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
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.
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 .)
This example reads values of the argument from a file, evaluates the function at each value of and prints the results.