Transcendental Functions

Exponential, Logarithmic, and Polylogarithmic Functions

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=\sum_{n=0}^\infty{z^n\over n!}, \quad\ln(1+z)=\sum_{n=1}^\infty(-1)^{n-1}{z^n\over n}.\]

Further information on the Dilog and Polylog functions can be found in Lewin [Lew81].

Exp(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over a real or complex field, return the exponential power series of \(f\).

Exp(c): FldComElt -> FldComElt
Exp(r): FldReElt -> FldReElt

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\).

Log(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over a real or complex field, return the logarithm of \(f\). The valuation of \(f\) must be zero.

Log(r): FldReElt -> FldReElt
Log(c): FldComElt -> FldComElt

Given a non-zero 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 complex number, unless the argument is real and positive, in which case a real number is returned.

Log(b, r): FldReElt -> FldReElt

Given real numbers \(b>0\), \(b\ne 1\), and \(r>0\), return the logarithm \(\log_b(r)\) of \(r\) to the base \(b\). Automatic coercion is applied if necessary.

Dilog(s): FldComElt -> FldComElt
Dilog(s): FldReElt -> FldReElt

For a given complex \(s\), this returns the value of the principal branch of the dilogarithm \({\operatorname{Li}}_2(s)\), which can be defined by

\[{\operatorname{Li}}_2(s)=-\int_0^s{\log(1-s)\over s}ds,\]

and forms the analytic continuation of the power series

\[\sum_{n=1}^\infty {s^n\over n^2},\]

(which is convergent for \(\vert s\vert\leq 1\)). For large values of the argument a functional equation like

\[{\operatorname{Li}}_2({-1\over s})+{\operatorname{Li}}_2(-s)=2{\operatorname{Li}}_2(-1)-{1\over2}\log^2(s)\]

should be used.

Polylog(m, f): RngIntElt, RngSerElt -> RngSerElt

For an integer \(m\geq 2\) and power series \(f\) defined over a real or complex field, return the \(m\)-th polylogarithm of the series \(f\). The valuation of \(f\) must be positive for \(m>1\).

Polylog(m, s): RngIntElt, FldComElt -> FldComElt

For given integer \(m\geq 2\) and complex \(s\) this returns the value of the principal branch of the polylogarithm \({\operatorname{Li}}_m(s)\), defined for \(m\geq 3\) by

\[{\operatorname{Li}}_m(s)=\int_0^s{{\operatorname{Li}}_{m-1}(s)\over s}ds\]

(and for \(m=2\) as the dilogarithm \({\operatorname{Li}}_2\)). Then \({\operatorname{Li}}_m\) is the analytic continuation of

\[\sum_{n=1}^\infty {s^n\over n^m},\]

(which is convergent for \(\vert s\vert\leq 1\)). For large values of the argument a functional equation like

\[(-1)^m{\operatorname{Li}}_m({-1\over s})+{\operatorname{Li}}_m(-s)=-{1\over m!}\log^m(s)+2\sum_{r=1}^{\lfloor m/2\rfloor}{\log^{m-2r}(s)\over (m-2r)!}{\operatorname{Li}}_{2r}(-1)\]

should be used. Pari is used here.

PolylogD(m, s): RngIntElt, FldComElt -> FldComElt
PolylogDold(m, s): RngIntElt, FldComElt -> FldComElt
PolylogP(m, s): RngIntElt, FldComElt -> FldComElt

Given integer \(m\geq 2\) and 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 \({\operatorname{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 [Zag]. Pari is used here.

Trigonometric Functions

The trigonometric functions may be computed for real and complex arguments or for power series defined over a real or complex field. The basic power series expansions are

\[\sin(z)=\sum_{n=0}^\infty{(-1)^{n+1}z^{2n+1}\over (2n+1)!}, \quad \cos(z)=\sum_{n=0}^\infty{(-1)^nz^{2n}\over (2n)!}.\]

Euler’s formulas relate these with the exponential functions via

\[\sin(z)={e^{{\mathrm{i}}z}-e^{-{\mathrm{i}}z}\over 2{\mathrm{i}}}, \quad \cos(z)={e^{{\mathrm{i}}z}+e^{-{\mathrm{i}}z}\over 2}.\]
Sin(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over a real or complex field, return the power series \(\sin(f)\).

Sin(c): FldComElt -> FldComElt
Sin(r): FldReElt -> FldReElt

Given a real or complex number \(c\), return the value \(\sin(c)\).

Cos(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over a real or complex field, return the power series \(\cos(f)\).

Cos(c): FldComElt -> FldComElt
Cos(r): FldReElt -> FldReElt

Given a real or complex number \(c\), return the value \(\cos(c)\).

Sincos(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over a real or complex field, return the two power series \(\sin(f)\) and \(\cos(f)\).

Sincos(s): FldReElt -> FldReElt, FldReElt
Sincos(s): FldComElt -> FldComElt, FldComElt

Given a real or complex number \(s\), return the two values \(\sin(s)\) and \(\cos(s)\).

Tan(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over the real or complex field, return the power series \(\tan(f)\).

Tan(c): FldComElt -> FldComElt
Tan(r): FldReElt -> FldReElt

Given a real or complex number \(c\), return the value \(\tan(c)={\sin(c)\over\cos(c)}\). Note that \(c\) should not be too close to one of the zeroes \((\pi/2 + n \cdot \pi)\) of \(\cos(z)\).

Cot(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over a real or complex field having valuation zero, return the power series \(\cot(f)\).

Cot(c): FldComElt -> FldComElt
Cot(r): FldReElt -> FldReElt

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 \cdot \pi\) of \(\sin(z)\).

Sec(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over a real or complex field, return the power series \(\sec(f)\).

Sec(c): FldComElt -> FldComElt
Sec(r): FldReElt -> FldReElt

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 \cdot \pi)\) of \(\cos(z)\).

Cosec(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over a real or complex field having valuation zero, return the power series \({\operatorname{cosec}}(f)\).

Cosec(c): FldComElt -> FldComElt
Cosec(r): FldReElt -> FldReElt

Given a real or complex number \(c\), return the value \({\operatorname{cosec}}(c)=1/\sin(c)\). Note that \(c\) should not be too close to one of the zeroes \(n \cdot \pi\) of \(\sin(z)\).

Inverse Trigonometric Functions

The inverse trigonometric functions are all available for arbitrary real or complex arguments. The principal values are chosen as indicated. We mention the power series expansions for the inverse of the sine and tangent functions (for \(\vert z\vert\leq 1\)):

\[\begin{split}\begin{aligned}\arcsin(z)&=\sum_{n=0}^\infty\bigl(\prod_{k=1}^{2n} k^{(-1)^{k-1}}\bigr){z^{2n+1}\over 2n+1},\\ \arctan(z)&=\sum_{n=1}^\infty(-1)^n{z^{2n+1}\over 2n+1}.\end{aligned}\end{split}\]

The important relations with the logarithmic function include

\[\begin{split}\begin{aligned}\arcsin(z)&={1\over{\mathrm{i}}}\log({\mathrm{i}}z+\sqrt{1-z^2}),\\ \arccos(z)&={1\over{\mathrm{i}}}\log(z+\sqrt{z^2-1}),\\ \arctan(z)&={1\over2{\mathrm{i}}}\log({1+{\mathrm{i}}z\over 1-{\mathrm{i}}z}).\end{aligned}\end{split}\]
Arcsin(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over a real or complex field. return the inverse sine of the power series \(f\).

Arcsin(r): FldReElt -> FldReElt
Arcsin(r): FldComElt -> FldComElt

Given a 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 complex number, unless \(s\) is real and \(-1\leq s\leq 1\), in which case a free real number is returned.

Arccos(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over a real or complex field. return the inverse cosine of the power series \(f\).

Arccos(r): FldReElt -> FldReElt
Arccos(r): FldComElt -> FldComElt

Given a 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 complex number, unless \(s\) is real and \(-1\leq s\leq 1\), in which case a free real number is returned.

Arctan(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over the real or complex field, return the inverse tangent of the power series \(f\).

Arctan(r): FldReElt -> FldReElt
Arctan(r): FldComElt -> FldComElt

Given a 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 complex number, unless \(s\) is real, in which case a free real number is returned.

Arctan(x, y): FldReElt, FldReElt -> FldReElt
Arctan2(x, y): FldReElt, FldReElt -> FldReElt

Given the real numbers \(x\) and \(y\), return the value \(v\) of \(\arctan(y/x)\) determined by the choice of signs for \(x\) and \(y\). That is, the value \(v\) is chosen in \((-\pi, \pi)\) in such a way that the signs of \(y\) and \(\sin(v)\) coincide, as well as the signs of \(x\) and \(\cos(v)\). An error occurs if \(x\) and \(y\) are both zero; if \(y\) is zero and \(x\) non-zero, the value returned is \({\operatorname{sign}}(x) \cdot \pi/2\).

The arguments are allowed to be in any real field (automatic coercion is used whenever necessary). Note that the ordering of \(x\) and \(y\) differs from the C math library function.

Arccot(r): FldReElt -> FldReElt
Arccot(r): FldComElt -> FldComElt

Given a 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 complex number, unless \(s\) is real, in which case a real number is returned.

Arcsec(r): FldReElt -> FldReElt
Arcsec(r): FldComElt -> FldComElt

Given a real or complex number \(s\), return a value \(t\) such that \(\sec(t)=s\). The principal value with real part in \([0, \pi/2)\cup(\pi/2, \pi]\) is chosen. The return value is a complex number, unless \(s\) is real, in which case a real number is returned.

Arccosec(r): FldReElt -> FldReElt
Arccosec(r): FldComElt -> FldComElt

Given a real or complex number \(s\), return a value \(t\) such that \({\operatorname{cosec}}(t)=s\). The principal value with real part in \([-\pi/2, 0)\cup(0, \pi/2]\) is chosen. The return value is a complex number, unless \(s\) is real, in which case a real number is returned.

Hyperbolic Functions

The hyperbolic functions are available for real and complex arguments, as specified below. The hyperbolic functions are defined using

\[\begin{split}\begin{aligned}\sinh(z)&={e^z-e^{-z}\over 2}, \\ \cosh(z)&={e^z+e^{-z}\over 2}.\end{aligned}\end{split}\]
Sinh(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over a real or complex field, return the hyperbolic sine of the power series \(f\).

Sinh(s): FldComElt -> FldComElt
Sinh(r): FldReElt -> FldReElt

Given a real or complex number \(s\), return \(\sinh(s)\). The result will be a real or complex value, in accordance with the argument.

Cosh(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over a real or complex field, return the hyperbolic cosine of the power series \(f\).

Cosh(r): FldReElt -> FldReElt
Cosh(r): FldComElt -> FldComElt

Given a real or complex number \(s\), return \(\cosh(s)\). The result will be a real or complex value, in accordance with the argument.

Tanh(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over a real or complex field, return the hyperbolic tangent of the power series \(f\).

Tanh(r): FldReElt -> FldReElt
Tanh(r): FldComElt -> FldComElt

Given a real or complex number \(s\), return \(\tanh(s)={\sinh(s) \over\cosh(s)}\). The result will be a real or complex value, in accordance with the argument.

Coth(r): FldReElt -> FldReElt
Coth(r): FldComElt -> FldComElt

Given a real or complex number \(s\), return \(\coth(s)={\cosh(s) \over\sinh(s)}\). The result will be a real or complex value, in accordance with the argument.

Sech(r): FldReElt -> FldReElt
Sech(r): FldComElt -> FldComElt

Given a real or complex number \(s\), return \({\operatorname{sech}}(s)=1/\cosh(s)\). The result will be a real or complex value, in accordance with the argument.

Cosech(r): FldReElt -> FldReElt
Cosech(r): FldComElt -> FldComElt

Given a real or complex number \(s\), return \({\operatorname{cosech}}(s)=1/\sinh(s)\). The result will be a real or complex value, in accordance with the argument.

Inverse Hyperbolic Functions

The inverse hyperbolic functions are available for real or complex arguments. The principal values are chosen as indicated.

Argsinh(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over a real or complex field, return the inverse hyperbolic sine of the power series \(f\).

Argsinh(r): FldReElt -> FldReElt
Argsinh(r): FldComElt -> FldComElt

Given a 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 complex number, unless the argument is real, in which case a real number is returned.

Argcosh(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over a real or complex field, return the inverse hyperbolic cosine of the power series \(f\).

Argcosh(r): FldReElt -> FldReElt
Argcosh(r): FldComElt -> FldComElt

Given a 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 complex number, unless the argument is real and \(s\ge 1\), in which case a real number is returned.

Argtanh(f): RngSerElt -> RngSerElt

Given a power series \(f\) defined over a real or complex field, return the inverse hyperbolic tangent of the power series \(f\).

Argtanh(s): FldReElt -> FldReElt
Argtanh(r): FldComElt -> FldComElt

Given a 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 complex number, unless the argument is real and \(-1<s<1\), in which case a real number is returned.

Argsech(s): FldReElt -> FldReElt
Argsech(r): FldComElt -> FldComElt

Given a real or complex number \(s\), return \(t\) such that \({\operatorname{sech}}(t))=s\); the principal value with imaginary part in \([0, \pi]\) is chosen. The return value is a complex number, unless the argument is real and \(\vert s\vert\ge 1\), in which case a real number is returned.

Argcosech(s): FldReElt -> FldReElt
Argcosech(r): FldComElt -> FldComElt

Given a real or complex number \(s\), return \(t\) such that \({\operatorname{cosech}}(t))=s\); the principal value with imaginary part in \([-\pi/2, \pi/2]\) is chosen. The return value is a complex number, unless the argument is real, in which case a real number is returned.

Argcoth(s): FldReElt -> FldReElt
Argcoth(r): FldComElt -> FldComElt

Given a 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 complex number, unless the argument is real and \(0<s\le 1\), in which case free real number is returned.