Axiom provides two basic floating point types:
Float and
DoubleFloat. This section
describes how to use numerical operations defined on these types and
the related complex types. As we mentioned in
An Overview of Axiom
in chapter 1., the
Float type is a software implementation of
floating point numbers in which the exponent and the significand may have
any number of digits. See
Float for detailed information about this
domain. The
DoubleFloat is usually a hardware
implementation of floating point numbers, corresponding to machine double
precision. The types
Complex Float and
Complex DoubleFloat are the
corresponding software implementations of complex floating point numbers.
In this section the term floating point type means any of these four
types. The floating point types immplement the basic elementary functions.
These include (where $ means
DoubleFloat,
Float,
Complex Float,
Complex DoubleFloat): exp,
log: $ -> $ sin,
cos,
tan,
cot,
sec,
csc: $ -> $ asin,
acos,
atan,
acot,
asec,
acsc: $ -> $ sinh,
cosh,
tanh,
coth,
sech,
csch: $ -> $ asinh,
acosh,
atanh,
acoth,
asech,
acsch: $ -> $ pi: () -> $ sqrt: $ -> $ nthRoot: ($,Integer) -> $ **: ($,Fraction Integer) -> $ **: ($,$) -> $
The handling of roots depends on whether the floating point type is
real or complex: for the real floating point types,
DoubleFloat and
Float, if a real root exists the one with
the same sign as the radicand is returned; for the complex floating
point types, the principal value is returned. Also, for real floating
point types the inverse functions produce errors if the results are not
real. This includes cases such as asin(1.2), log(-3.2), sqrt(-1,1).
The default floating point type is Float
or Complex Float, just use normal
decimal notation.
A number of special functions are provided by the package
DoubleFloatSpecialFunctions
for the machine precision floating point types. The special functions
provided are listed below, where F stands for the types
Float
or Complex Float. The real versions
of the functions yield an error if the result is not real.
Gamma: F -> F
Gamma(z) is the Euler gamma
function, Gamma(Z), defined by
Gamma(z) = integrate(t^(z-1)*exp(-t),t=0..%infinity)
Beta: F -> F
Beta(u,v) is the Euler Beta
function B(u,v), defined by
Beta(u,v)=integrate(t^(u-1)*(1-t)^(b-1),t=0..1)
This is related to Gamma(z) by
Beta(u,v)=Gamma(u)*Gamma(v)/Gamma(u+v)
logGamma: F -> F
logGamma(z) is the natural logarithm of Gamma(z). This can often be
computed even if Gamma(z) cannot.
digamma: F -> F
digamma(z), also called psi(z), is the function psi(z), defined by
psi(z)=Gamma'(z)/Gamma(z)
polygamma: (NonNegativeInteger, F) -> F
polygamma(n,z) is the n-th derivative of digamma(z)
besselJ: (F, F) -> F
besselJ(v,z) is the Bessel function of the first kind, J(v,z). This
function satisfies the differential equation
z^(2w)''(z)+zw'(z)+(z^2-v^2)w(z)=0
besselY: (F, F) -> F
besselY(v,z) is the Bessel function of the second kind, Y(v,z). This
function satisfies the same differential equation as
besselJ. The implementation simply
uses the relation
Y(v,z)=(J(v,z)cos(v*%pi)-J(-v,z))/sin(v*%pi)
besselI: (F, F) -> F
besselI(v,z) if the modifed Bessel function of the first kind, I(v,z).
This function satisfies the differential equation
z^2w''(z)+zw'(z)-(z^2+v^2)w(z)=0
besselK: (F, F) -> F
besselK(v,z) is the modifed Bessel function of the second kind, K(v,z).
This function satisfies the same differential equation as
besselI. The implementation simply uses
the relation
K(v,z)=%pi*(I(v,z)-I(-v,z))/(2sin(v*%pi))
airyAi: F -> F
airyAi(z) is the Airy function Ai(z). This function satisfies the
differential equation
w''(z)-zw(z)=0
The implementation simply uses the relation
Ai(-z)=1/3*sqrt(z)*(J(-1/3,2/3*z^(3/2))+J(1/3,2/3*z^(3/2)))
airyBi: F -> F
airyBi(z) is the Airy function Bi(z). This function satisfies the
same differential equation as airyAi.
The implementation simply uses the relation
Bi(-z)=1/3*sqrt(3*z)*(J(-1/3,2/3*z^(3/2))-J(1/3,2/3*z^(3/2)))
hypergeometric0F1: (F, F) -> F
hypergeometric0F1(c,z) is the hypergeometric function 0F1(;c;z). The above
special functions are defined only for small floating point types. If you
give Float arguments, they are converted to
DoubleFloat by Axiom.