In this section the exponential and logarithmic functions to the natural base e are described, as well as the conversion to the logarithm with respect to any base.
The power series expansions are
e^z= the sum from n=0 to infinity of (z^n/n!)
and ln(1 + z)= the sum from n=1 to infinity of ( - 1)^(n - 1)(z^n/n).
More on the Dilog and Polylog functions can be found in Lewin
[Leonard Lewin, Polylogarithms and associated functions,
New York: North Holland, 1981].
Exp(s) : FldPrElt -> FldPrElt
Given an arbitrary real or complex number c, return the exponential e^c of c. Here c is allowed to be free or of fixed precision, and the result is in the same field as c.
Given a non-zero free real or complex number c, return the logarithm of c (to the natural base e). The principal value with imaginary part in ( - pi, pi] is chosen. The result will be a free complex number, unless the argument is real and positive, in which case a free real number is returned.The argument is also allowed to be a real or complex number of fixed precision. A fixed precision real argument must be positive, and the result will be real of the same precision. A fixed precision complex argument must be non-zero, and yields a complex value of the same precision.
Given non-negative real numbers b and r, return the logarithm log_b(r) of a to the base b. Here both r and b may be of fixed precision or free. Automatic coercion is applied if necessary.
For given complex s of fixed precision or free real or complex s, this returns the value of the principal branch of the dilogarithm Li_2(s), which can be defined by Li_2(s)=the negative of the integral from 0 to s of (log(1 - s)/s)ds, and forms the analytic continuation of the power series sum from n=1 to infinity of (s^n/n^2), (which is convergent for | s| <= 1). For large values of the argument a functional equation like Li_2((-1/s)) + Li_2( - s)=2Li_2( - 1) - (1/2)log^2(s) should be used.
For given integer m >= 2 and complex s of fixed precision or free real or complex s, this returns the value of the principal branch of the polylogarithm Li_m(s), defined for m >= 3 by Li_m(s)= the integral from 0 to s given by (Li_(m - 1)(s)/s)ds (and for m=2 as the dilogarithm Li_2). Then Li_m is the analytic continuation of the sum from n=1 to infinity of (s^n/n^m), (which is convergent for | s| <= 1). For large values of the argument a functional equation like ( - 1)^m Li_m((-1/s)) + Li_m( - s)= - (1/m!)log^m(s) + 2sum_(r=1)^( Floor(m/2))(log^(m - 2r)(s)/(m - 2r)!)Li_(2r)( - 1) should be used.
Given integer m >= 2 and complex s of fixed precision or free real or complex s, this returns the value of the principal branch of the modified versions tilde D_m, D_m and P_m of the polylogarithm Li_m(s); all of these satisfy functional equations of the form f_m(1/s)=( - 1)^mf_m(s). For their definition and main properties, see Zagier [D. Zagier, Polylogarithms, Dedekind Zeta Functions, and the Algebraic K-Theory of Fields, pp. 377--390 in: G. van der Geer, F. Oort, J. Steenbrink (eds), Arithmetic Algebraic Geometry, Progress in Mathematics 89, Basel: Birkhäuser, 1991].
The trigonometric functions are available for all real and complex
arguments. The basic power series expansions are
sin(z)=the sum from n=0 to infinity of (( - 1)^(n + 1)z^(2n + 1)/(2n + 1)!),
and cos(z)=the sum from n=0 to infinity of (( - 1)^nz^(2n)/(2n)!).
Euler's formulas relate these with the exponential functions via
sin(z)=(e^(i z) - e^(-i z)/2i), cos(z)=(e^(i z) + e^(-i z)/2).
Sin(c) : FldComElt -> FldComElt
Given a real or complex number c, return the value sin(c).
Given a real or complex number c, return the value cos(c).
Given a free real or complex number s, return the two values sin(s) and cos(s). This function is not implemented for fixed precision reals or complexes.
Given a real or complex number c, return the value tan(c)=(sin(c)/cos(c)). Note that c should not be too close to one of the zeroes (pi/2 + n .pi) of cos(z).
Given a real or complex number c, return the value cot(c)=(cos(c)/sin(c)). Note that c should not be too close to one of the zeroes n .pi of sin(z).
Given a real or complex number c, return the value sec(c)=1/cos(c). Note that c should not be too close to one of the zeroes (pi/2 + n .pi) of cos(z).
Given a real or complex number c, return the value cosec(c)=1/sin(c). Note that c should not be too close to one of the zeroes n .pi of sin(z).
The inverse trigonometric functions are all available for arbitrary free (real or complex) argument, as well as for restricted real arguments of fixed precision. The principal values are chosen as indicated.
We mention the power series expansions for the inverse of the sine and
tangent functions (for | z| <= 1):
eqalign(
arcsin(z)&=sum_(n=0)^Infinity bigl(prod_(k=1)^(2n) k^(( - 1)^(k - 1))bigr)(z^(2n + 1)/2n + 1), cr
arctan(z)&=sum_(n=1)^Infinity( - 1)^n(z^(2n + 1)/2n + 1).cr)
The important relations with the logarithmic function include
eqalign(
arcsin(z)&=(1/i)log(i z + sqrt(1 - z^2)), cr
arccos(z)&=(1/i)log(z + sqrt(z^2 - 1)), cr
arctan(z)&=(1/2i)log((1 + i z/1 - i z)).cr)
Arcsin(s) : FldPrElt -> FldPrElt
Given an arbitrary free real or complex number s, return a value t such that sin(t)=s. The principal value with real part in [ - pi/2, pi/2] is chosen. The return value is a free complex number, unless s is real and and -1 <= s <= 1, in which case a free real number is returned.The argument s is also allowed to be a fixed precision real number satisfying -1 <= s <= 1; the fixed precision real value returned will again be in the interval [ - pi/2, pi/2].
Given an arbitrary free real or complex number s, return a value t such that cos(t)=s. The principal value with real part in [0, pi] is chosen. The return value is a free complex number, unless s is real and and -1 <= s <= 1, in which case a free real number is returned.The argument s is also allowed to be a fixed precision real number satisfying -1 <= s <= 1; the fixed precision real value returned will again be in the interval [0, pi].
Given an arbitrary free real or complex number s, return a value t such that tan(t)=s. The principal value with real part in ( - pi/2, pi/2) is chosen. The return value is a free complex number, unless s is real, in which case a free real number is returned.The argument s is also allowed to be a fixed precision real number; the fixed precision real value returned will again be in the interval [ - pi/2, pi/2).
Given the real numbers a and b, return the value v of arctan(a/b) determined by the choice of signs for a and b. That is, the value v is chosen in ( - pi, pi) in such a way that the signs of a and sin(v) coincide, as well as the signs of b and cos(v). An error occurs if a and b are both zero; if b is zero and a non-zero, the value returned is sign(a) .pi/2.The arguments are allowed to be in any real field (automatic coercion is used whenever necessary).
Given an arbitrary free real or complex number s, return a value t such that cot(t)=s. The principal value with real part in ( - pi/2, pi/2) is chosen. The return value is a free complex number, unless s is real, in which case a free real number is returned.The argument s is also allowed to be a fixed precision real number; the fixed precision real value returned will again be in the interval [ - pi/2, pi/2).
Given an arbitrary free real or complex number s, return a value t such that sec(t)=s. The principal value with real part in [0, pi/2)union(pi/2, pi] is chosen. The return value is a free complex number, unless s is real, in which case a free real number is returned.The argument s is also allowed to be a fixed precision real number; the fixed precision real value returned will again be between 0 and pi.
Given an arbitrary free real or complex number s, return a value t such that cosec(t)=s. The principal value with real part in [ - pi/2, 0)union(0, pi/2] is chosen. The return value is a free complex number, unless s is real, in which case a free real number is returned.The argument s is also allowed to be a fixed precision real number; the fixed precision real value returned will again be between -pi/2 and pi/2.
The hyperbolic functions are available for arbitrary free (real and complex) arguments, and certain fixed precision real arguments, as specified below.
The hyperbolic functions are defined using
eqalign(
sinh(z)&=(e^z - e^(-z)/2), cr
cosh(z)&=(e^z + e^(-z)/2).cr)
Sinh(s) : FldPrElt -> FldPrElt
Given an arbitrary free real or complex number s, return sinh(s). The result will be a free real or complex value, in accordance with the argument.The argument s is also allowed to be a fixed precision real number, in which case the result will be a real number of the same fixed precision.
Given an arbitrary free real or complex number s, return cosh(s). The result will be a free real or complex value, in accordance with the argument.The argument s is also allowed to be a fixed precision real number, in which case the result will be a real number of the same fixed precision.
Given an arbitrary free real or complex number s, return tanh(s)=(sinh(s) /cosh(s)). The result will be a free real or complex value, in accordance with the argument.The argument s is also allowed to be a fixed precision real number, in which case the result will be a real number of the same fixed precision.
Given an arbitrary free real or complex number s, return coth(s)=(cosh(s) /sinh(s)). The result will be a free real or complex value, in accordance with the argument.The argument s is also allowed to be a fixed precision real number, in which case the result will be a real number of the same fixed precision.
Given an arbitrary free real or complex number s, return sech(s)=1/cosh(s). The result will be a free real or complex value, in accordance with the argument.The argument s is also allowed to be a fixed precision real number, in which case the result will be a real number of the same fixed precision.
Given an arbitrary free real or complex number s, return cosech(s)=1/sinh(s). The result will be a free real or complex value, in accordance with the argument.The argument s is also allowed to be a fixed precision real number, in which case the result will be a real number of the same fixed precision.
The inverse hyperbolic functions are available for arbitrary
free (real or complex) argument, as well as for restricted real
arguments of fixed precision. The principal values are chosen as
indicated.
Argsinh(s) : FldPrElt -> FldPrElt
Given an arbitrary free real or complex number s, return t such that sinh(t)=s; the principal value with imaginary part in [ - pi/2, pi/2] is chosen. The return value is a free complex number, unless the argument is real, in which case a free real number is returned.The argument s is also allowed to be a real number of fixed precision; a real number of the same precision will be returned.
Given an arbitrary free real or complex number s, return t such that cosh(t))=s; the principal value with imaginary part in [0, pi] is chosen. The return value is a free complex number, unless the argument is real and s >= 1, in which case a free real number is returned.The argument s is also allowed to be a real number of fixed precision greater than or equal to 1; a real number of the same precision will be returned.
Given an arbitrary free real or complex number s, return t such that tanh(t)=s; the principal value with imaginary part in [ - pi/2, pi/2] is chosen. The return value is a free complex number, unless the argument is real and -1<s<1, in which case a free real number is returned.The argument s is also allowed to be a real number of fixed precision with -1< s< 1; a real number of the same precision will be returned.
Given an arbitrary free real or complex number s, return t such that coth(t))=s; the principal value with imaginary part in [ - pi/2, pi/2] is chosen. The return value is a free complex number, unless the argument is real and 0<s <= 1, in which case a free real number is returned.The argument s is also allowed to be a real number of fixed precision with 0<s <= 1; a real number of the same precision will be returned.
Given an arbitrary free real or complex number s, return t such that sech(t))=s; the principal value with imaginary part in [0, pi] is chosen. The return value is a free complex number, unless the argument is real and | s| >= 1, in which case a free real number i s returned.The argument s is also allowed to be a real number of fixed precision with | s| >= 1; a real number of the same precision will be returned.
Given an arbitrary free real or complex number s, return t such that cosech(t))=s; the principal value with imaginary part in [ - pi/2, pi/2] is chosen. The return value is a free complex number, unless the argument is real, in which case a free real number is returned.The argument s is also allowed to be a real number of fixed precision; a real number of the same precision will be returned.
The elliptic and modular functions below are defined for free
arguments only. More information on elliptic functions can be found
for example in Chandrasekharan
[K. Chandrasekharan, Elliptic Functions, Grundlehren
der mathematischen Wissenschaften 281, Berlin: Springer, 1985], and
for modular functions and their use see Koblitz
[Neal Koblitz, Introduction to Elliptic Curves
and Modular Forms, Graduate Texts in Mathematics 97, New York:
Springer, 1984].
JacobiTheta(q, z) : FldPrElt, FldPrElt -> FldPrElt
For free real or complex numbers q, z satisfying | q|<1, return the value of theta(q, z), the first of Jacobi's theta functions. Here theta(q, z) is defined by theta(q, z)=(1/i)sum_(n= - Infinity)^Infinity( - 1)^nq^((n + (1/2))^2)e^((2n + 1)i z)=2sum_(n=0)^Infinity( - 1)^nq^((n + (1/2))^2)sin(2n + 1)z.Defined this way, theta satisfies theta(q, - z)= - theta(q, z), it is periodic with period 2pi in the second variable: theta(q, z + 2pi)= theta(q, z), and its zeroes are of the form m_1pi + m_2(log x/i) for any integers m_1, m_2.
For integer k >= 0, return the k-th derivative theta^((k))(q, 0) of theta(q, z) at z=0.
For free complex argument s with positive imaginary part, this returns the value of prod_(n=1)^Infinity(1 - q^n) where q=e^(2pi i s). Up to a factor q^(1/24) this is the value of Dedekind's function eta defined by eta(s)=prod_(n=1)^Infinity e^(2pi i s/24)(1 - e^(2pi i ns)).
For free complex argument s with positive imaginary part, this returns the value of the elliptic j-invariant at s. This is a modular function of weight 0 whose Fourier expansion starts with j(s)=e^(-2pi i s) + 744e(2pi i s) + 196884e(2pi i s) + ... .
For a lattice argument L = [a,b], this returns the value of the elliptic j-invariant of L. This is the j-invariant of tau where tau = a/b or tau = b / a, whichever is in the upper half complex plane.
For a binary quadratic form F = ax^2 + bxy + cy^2 with negative discriminant, this returns the elliptic j-invariant of F. This is the j-invariant of tau where tau = ( - b + sqrt(b^2 - 4ac)) / (2a).
For free complex argument s with positive imaginary part, this returns the value of Weber's function f, defined in such a way that j(s)=((f(s)^24 - 16)^3/f(s)^24).
For free complex argument s with positive imaginary part, this returns the value of Weber's function f_2, defined in such a way that j(s)=((f_2(s)^24 + 16)^3/f_2(s)^24).
As a general reference to the functions decribed in this section (and much
more), we refer the reader to Whittaker and Watson
[E. T. Whittaker, G. N. Watson, A course of
modern analysis, Cambridge: Cambridge University Press, 1915 (second ed.)].
Gamma(s) : FldPrElt -> FldPrElt
Given a positive real number of fixed precision, or a free real or complex number s (not equal to 0, - 1, - 2, ... ), calculate the value Gamma(s) of the gamma function at s. For s with positive real part this is the value of the integral from 0 to infinity of u^(x - 1)e^(-u) with respect to u. For other s (not a non-positive integer) the function is defined by analytic continuation, and it satisfies the product formula (1/s Gamma(s))=e^(gamma s)prod_(n=1)^Infinity (1 + (s/n))e^(-s/n). The function Gamma also satisfies Gamma(s)Gamma(1 - s)=(pi/(sin(pi s))), and Gamma(s + 1)=s Gamma(s).
Complementary: BoolElt Default: false
Gamma: FldPrElt Default: -
For free or fixed precision real numbers s, t this returns the value of the incomplete gamma function gamma(s, t)=int_0^t u^(s - 1)e^(-u)du. The optional argument Complementary can be used to find the complement int_t^Infinity u^(s - 1)e^(-u)du instead. If the arguments are free real numbers, there is a second optional argument that may be used in the computation of the incomplete gamma value; the free real value of Gamma should be the value of Gamma(s), in which case gamma(s, t) may be computed as the difference between the given value for Gamma(s) and that of the complementary gamma at s, t.
For free real s (such that s + (1/2) is not a non-positive integer) this returns the value of Gamma(s + (1/2)). For integer values of s this is faster than Gamma(s+(1/2)), because Legendre's doubling formula Gamma(s + (1/2))=2^(1 - 2s)sqrt(pi)(Gamma(2s)/Gamma(s)) is used.
For fixed precision positive real s or free real or complex s (not a non-positive integer) return the value of the principal branch of the logarithm of the gamma function of s.
For free real or complex s (not a non-positive integer) return the principal value of the logarithmic derivative Psi(s)=(d log Gamma(s)/ds)=(Gamma'(s)/Gamma(s)), of the gamma function, which allows the expansion Psi(s)= - gamma - (1/s) + s sum_(n=1)^Infinity(1/n(s + n)); here gamma is Euler's gamma.
Given a small integer n and a real number r of fixed precision, calculate the value of the Bessel function y = J_n(r), of the first kind of order n. Results for negative arguments are defined by: J_(-n)(r) = J_n( - r) = ( - 1)^n J_n(r). The Bessel function of the first kind of order n is defined by J_n(x)=(1/2pi i)((z/2))^n int_(-Infinity)^(0^ + ) u^(-n - 1)e^(u - (z^2/4t))du, and satisfies J_n(x)=sum_(k=0)^Infinity (( - 1)^kz^(n + 2k)/2^(n + 2k)k!Gamma(n + k + 1)). The method used is Hankel's asymptotic expansion if abs(r) is large, the power series if abs(r) is small, and the backward recurrence method otherwise.
Given a small integer n and a free real or complex number s, calculate the value of the Bessel function of the first kind of half integral index n + (1/2), J_(n + (1/2)), defined as above.
Given a free complex n and a free positive real s, compute the value of the modified Bessel function of the second kind K_n(s), which may be defined by K_n(s)=(pi/2)(i^nJ_(-n)(i s) - i^(-n)J_n(s))cot(npi). The function KBessel2 is an alternative (often faster) implementation of this function.
For positive free real s and free complex arguments a and b this function returns the value of the confluent hypergeometric function U(a, b, s). This can be defined by U(a, b, s)=(1/Gamma(a))int_(u=0)^Infinity e^(-su)u^(a - 1)(1 + u)^(b - a - 1))du.
Returns the arithmetic-geometric mean of the free real or complex numbers x and y, defined as the limit of either of the sequences x_i, y_i where x_0 = x, y_0 = y and x_(i + 1) = (x_i + y_i)/2, y_(i + 1) = sqrt(x_i y_i). The function calculates both sequences, and when the numbers are within the desired precision of each other, it returns one of them.
For a non-negative integer n, return the value of the n-th Bernoulli number B_n, defined by (t/e^t - 1)=sum_(n=0)^Infinity B_n(t^n/n!).
For a non-negative integer n, return an approximation in the field of free real numbers to the value of the n-th Bernoulli number B_n, defined by (t/e^t - 1)=sum_(n=0)^Infinity B_n(t^n/n!).
Given a real number r, compute the value of Dawson's integral, e^(-x^2) times the integral from 0 to x of e^(u^2) with respect to u, at x = r.
Given a real number r, calculate the value of the error function erf. This is the value of the square root of (4/pi) times the integral from 0 to x of e^(-u^2) with respect to u, at x = r for r>0, and for r<0 it is defined by erf(x)= - erf( - x), while erf(0)=0.Here r is allowed to be free or of fixed precision, and the result will be in the same field.
Given a real number r, calculate the value of the complementary error function. This is the value of y = ( erfc)(x) = 1 - erf(x). for the error function erf as defined above.Here r is allowed to be free or of fixed precision, and the result will be in the same field.
Given a real number r, calculate the value of the exponential integral, the principal value of the integral from minus infinity to x of e^u / u with respect to u at x = r.Here r is allowed to be free or of fixed precision, and the result will be in the same field.
Given a non-negative real number r that is not equal to 1, evaluate the logarithmic integral y = li(x) at x = r. This integral is defined to be the principal value of the integral from 0 to x of 1 / log(u) with respect to u.
These functions calculate values of the Riemann zeta-function, which is the analytic continuation of zeta(z) = the sum from i equals 1 to infinity of 1 / i^n (convergent for Re(z)> 1). The version with one argument takes a free real or complex number r != 1 and returns a free real or complex number.[Next] [Prev] [Right] [Left] [Up] [Index] [Root]The version with two arguments is much more restricted; it takes a real field R of fixed precision and an integer n != 1, and returns zeta(n) in R.
For non-integer arguments the Euler-Maclaurin series is used, for non-positive and even positive integers the Bernoulli numbers are used. The fixed precision version uses Euler-Maclaurin for odd positive integers as well, the free version uses modular forms.