moreFun
index
/users/schrei_f/src/py4CAtS/aux/moreFun.py

A 'random' collection of some useful(?) mathematical functions:
 
sindg       sine   for angle x given in degrees
cosdg       cosine for angle x given in degrees
asindg      arcsin with angle returned in degrees
acosdg      arccos with angle returned in degrees
Sinc        Sinc(x) = sin(x)/x
j2_over_xx  spherical Bessel function of the first kind divided by x**2
nexprl      relative error exponential for negative exponent:  (exp(-x)-1)/x
erf         error function (using rational approximation)

 
Modules
       
math
numpy

 
Functions
       
Sinc(x)
Sinc(x) = sin(x)/x
For small arguments x<1e-3 Taylor expansion is used.
 
NOTE:  numpy defines the 'cardinal sinc' with an extra factor pi:
       sinc = sinc(pi*x)/(pi*x)
acosdg(x)
Compute arccos and return angle alpha given in degrees.
asindg(x)
Compute arcsin and return angle alpha given in degrees.
cosdg(x)
Compute cosine for angle x given in degrees.
erf(x)
Compute the error function using a rational approximation for the exp scaled complementary error function.
erf(x)   = 1 - exp(-x^2)*erfcx(x)
erfcx(x) = exp(x^2) * erfc(x) = exp(x^2) * [1 - erf(x)]
Accuracy 1.5e-7
Literature:  Abramowitz&Stegun 1964: 7.1.26
j2_over_xx(x)
Spherical Bessel function of the first kind divided by x**2
j_2 = sqrt(0.5*pi/x) J_{5/2} = spherical Bessel function of the first kind,
http://dlmf.nist.gov/10.49.E3
nexprl(x)
Relative error exponential  (EXP(-x)-1)/x  for negative exponent.
see also:  http://www.netlib.no/netlib/slatec/fnlib/exprel.f and dexprl.f
sindg(x)
Compute sine for angle x given in degrees.

 
Data
        __all__ = ['sindg', 'cosdg', 'asindg', 'acosdg', 'Sinc', 'j2_over_xx', 'nexprl', 'erf']