]>
Axiom provides two basic floating-point types: Float and DoubleFloat. This section describes how to use numerical function:numeric operations defined on these types and the related complex types. numeric operations
As we mentioned in Chapter ugIntro , the Float type is a software implementation of floating-point numbers in which the exponent and the floating-point number significand may have any number of digits. number:floating-point See FloatXmpPage for detailed information about this domain. The DoubleFloat (see DoubleFloatXmpPage ) is usually a hardware implementation of floating point numbers, corresponding to machine double precision. The types Complex Float and Complex DoubleFloat are floating-point number:complex the corresponding software implementations of complex floating-point numbers. complex:floating-point number In this section the term floating-point type means any of these number:complex floating-point four types.
The floating-point types implement the basic elementary functions. These include (where $ means DoubleFloat, Float, Complex DoubleFloat, or Complex Float):
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) -> $
****Float: ($, Fraction Integer) -> $
****Float: ($,$) -> $
The handling of roots depends on whether the floating-point type root:numeric approximation 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. principal value Also, for real floating-point types the inverse functions produce errors if the results are not real. This includes cases such as , , .
The default floating-point type is Float so to evaluate functions using Float or Complex Float, just use normal decimal notation.
To evaluate functions using DoubleFloat or Complex DoubleFloat, a declaration or conversion is required.
A number of special functions are provided by the package DoubleFloatSpecialFunctions for the machine-precision special functions floating-point types. DoubleFloatSpecialFunctions The special functions provided are listed below, where stands for the types DoubleFloat and Complex DoubleFloat. The real versions of the functions yield an error if the result is not real. function:special
Gamma:
is the Euler gamma function,
function:Gamma
,
defined by
Euler:gamma function
Beta:
is the Euler Beta function,
function:Euler Beta
, defined by
Euler:Beta function
This is related to by
logGamma:
is the natural logarithm of
.
This can often be computed even if
cannot.
digamma:
, also called ,
psi @
is the function
function:digamma
defined by
polygamma:
is the -th derivative of
function:polygamma
, written .
besselJ:
is the Bessel function of the first kind,
function:Bessel
.
This function satisfies the differential equation
besselY:
is the Bessel function of the second kind,
function:Bessel
.
This function satisfies the same differential equation as
besselJ.
The implementation simply uses the relation
besselI:
is the modified Bessel function of the first kind,
function:Bessel
.
This function satisfies the differential equation
besselK:
is the modified Bessel function of the second kind,
function:Bessel
.
This function satisfies the same differential equation as besselI.
Bessel function
The implementation simply uses the relation
airyAi:
is the Airy function .
function:Airy Ai
This function satisfies the differential equation
The implementation simply uses the relation
airyBi:
is the Airy function .
function:Airy Bi
This function satisfies the same differential equation as airyAi.
Airy function
The implementation simply uses the relation
hypergeometric0F1:
is the hypergeometric function
function:hypergeometric
.
The above special functions are defined only for small floating-point types. If you give Float arguments, they are converted to DoubleFloat by Axiom.
A number of additional operations may be used to compute numerical values. These are special polynomial functions that can be evaluated for values in any commutative ring , and in particular for values in any floating-point type. The following operations are provided by the package OrthogonalPolynomialFunctions: OrthogonalPolynomialFunctions
chebyshevT:
is the -th Chebyshev polynomial of the first
kind, . These are defined by
chebyshevU:
is the -th Chebyshev polynomial of the second
kind, . These are defined by
hermiteH:
is the -th Hermite polynomial,
.
These are defined by
laguerreL:
is the -th Laguerre polynomial,
.
These are defined by
laguerreL:
is the associated Laguerre polynomial
.
This is the -th derivative of .
legendreP:
is the -th Legendre polynomial,
. These are defined by
These operations require non-negative integers for the indices, but otherwise the argument can be given as desired.
The expression evaluates to the -th Chebyshev polynomial:Chebyshev:of the first kind polynomial of the first kind.
The expression evaluates to the -th Chebyshev polynomial:Chebyshev:of the second kind polynomial of the second kind.
The expression evaluates to the -th Hermite polynomial:Hermite polynomial.
The expression evaluates to the -th Laguerre polynomial:Laguerre polynomial.
The expression polynomial:Legendre evaluates to the -th Legendre polynomial,
Finally, three number-theoretic polynomial operations may be evaluated. number theory The following operations are provided by the package NumberTheoreticPolynomialFunctions. NumberTheoreticPolynomialFunctions.
bernoulliB:
is the -th Bernoulli polynomial,
polynomial:Bernoulli
. These are defined by
eulerE:
is the -th Euler polynomial,
Euler:polynomial
. These are defined by
polynomial:Euler
cyclotomic:
is the -th cyclotomic polynomial
. This is the polynomial whose
roots are precisely the primitive -th roots of unity.
Euler:totient function
This polynomial has degree given by the Euler totient function
function:totient
.
The expression evaluates to the -th Bernoulli polynomial:Bernouilli polynomial.
The expression polynomial:Euler evaluates to the -th Euler polynomial.
The expression polynomial:cyclotomic evaluates to the -th cyclotomic polynomial. cyclotomic polynomial
Drawing complex functions in Axiom is presently somewhat awkward compared to drawing real functions. It is necessary to use the draw operations that operate on functions rather than expressions.
This is the complex exponential function (rotated interactively). function:complex exponential When this is displayed in color, the height is the value of the real part of the function and the color is the imaginary part. Red indicates large negative imaginary values, green indicates imaginary values near zero and blue/violet indicates large positive imaginary values.
This is the complex arctangent function. function:complex arctangent Again, the height is the real part of the function value but here the color indicates the function value's phase. The position of the branch cuts are clearly visible and one can see that the function is real only for a real argument.
This is the complex Gamma function.
This shows the real Beta function near the origin.
This is the Bessel function for index in the range and argument in the range .
This is the modified Bessel function evaluated for various real values of the index and fixed argument .
This is similar to the last example except the index takes on complex values in a rectangle centered on the origin.