[Next][Prev] [Right] [Left] [Up] [Index] [Root]

Transcendental Functions

In each of the functions below, the precision of the result will be approximately equal to the precision of the argument if that is finite; otherwise it will be approximately equal to the default precision of the parent of the argument. An error will result if the coefficient ring of the power series is not a field. If the first argument has a non-zero constant term, an error will result unless the coefficient ring of the parent is a real or complex domain (so that the transcendental function can be evaluated in the constant term).

See also the chapter on real and complex fields for elliptic and modular functions which are also defined for formal series.

Subsections

Exponential and Logarithmic Functions

Exp(f) : RngSerElt -> RngSerElt
Given a power series f defined over a field, return the exponential of f.
Log(f) : RngSerElt -> RngSerElt
Given a power series f defined over a field of characteristic zero, return the logarithm of f. The valuation of f must be zero.


Example RngSer_Bernoulli (H60E3)

In this example we show how one can compute the Bernoulli number B_(n) for given n using generating functions. The function BernoulliNumber now actually uses this method (since V2.4). Using this method, the Bernoulli number B_(10000) has been computed, taking about 14 hours on a 250MHz Sun Ultrasparc (the computation depends on the new asymptotically fast methods for series division).

The exponential generating function for the Bernoulli numbers is: E(x) = (x /(e^x - 1)). This means that the n-th Bernoulli number B_n is n! times the coefficient of x^n in E(x). The Bernoulli numbers B_0, ..., B_n for any n can thus be calculated by computing the above power series and scaling the coefficients.

In this example we will compute B_(500). We first set the final coefficient index n we desire to be 500. We then create the denominator D = e^x - 1 of the exponential generating function to precision n + 2 (we need n + 2 since we lose precision when we divide by the denominator and the valuation changes). For each series we create, we print the sum of it and ( O)(x^(20)), which will only print the terms up to x^(19).

> n := 500;
> S<x> := LaurentSeriesRing(RationalField(), n + 2);
> time D := Exp(x) - 1;
Time: 0.040
> D + O(x^20);
x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + 1/120*x^5 + 1/720*x^6 + 1/5040*x^7 + 
    1/40320*x^8 + 1/362880*x^9 + 1/3628800*x^10 + 1/39916800*x^11 + 
    1/479001600*x^12 + 1/6227020800*x^13 + 1/87178291200*x^14 + 
    1/1307674368000*x^15 + 1/20922789888000*x^16 + 1/355687428096000*x^17 + 
    1/6402373705728000*x^18 + 1/121645100408832000*x^19 + O(x^20)
We then form the quotient E=x/D which gives the exponential generating function.

> time E := x / D;
Time: 5.330
> E + O(x^20);
1 - 1/2*x + 1/12*x^2 - 1/720*x^4 + 1/30240*x^6 - 1/1209600*x^8 + 
    1/47900160*x^10 - 691/1307674368000*x^12 + 1/74724249600*x^14 - 
    3617/10670622842880000*x^16 + 43867/5109094217170944000*x^18 + O(x^20)
We finally compute the Laplace transform of E (which multiplies the coefficient of x^i by i!) to yield the generating function of the Bernoulli numbers up to the x^n term. Thus the coefficient of x^(n) here is B_(n).

> time B := Laplace(E);
Time: 0.289
> B + O(x^20);
1 - 1/2*x + 1/6*x^2 - 1/30*x^4 + 1/42*x^6 - 1/30*x^8 + 5/66*x^10 - 
    691/2730*x^12 + 7/6*x^14 - 3617/510*x^16 + 43867/798*x^18 + O(x^20)
> Coefficient(B, n);
-16596380640568557229852123088077134206658664302806671892352650993155331641220\
960084014956088135770921465025323942809207851857992860213463783252745409096420\
932509953165466735675485979034817619983727209844291081908145597829674980159889\
976244240633746601120703300698329029710482600069717866917229113749797632930033\
559794717838407415772796504419464932337498642714226081743688706971990010734262\
076881238322867559275748219588404488023034528296023051638858467185173202483888\
794342720837413737644410765563213220043477396887812891242952336301344808165757\
942109887803692579439427973561487863524556256869403384306433922049078300720480\
361757680714198044230522015775475287075315668886299978958150756677417180004362\
981454396613646612327019784141740499835461/8365830
> n;
500

Trigonometric Functions and their Inverses

Sin(f) : RngSerElt -> RngSerElt
Given a power series f defined over a field of characteristic zero, return the sine of f. The valuation of f must be zero.
Cos(f) : RngSerElt -> RngSerElt
Given a power series f defined over a field of characteristic zero, return the cosine of f. The valuation of f must be zero.
Sincos(f) : RngSerElt -> RngSerElt
Given a power series f defined over a field of characteristic zero, return both the sine and cosine of f. The valuation of f must be zero.
Tan(f) : RngSerElt -> RngSerElt
Return the tangent of the power series f defined over a field.
Arcsin(f) : RngSerElt -> RngSerElt
Given a power series f defined over a field of characteristic zero, return the inverse sine of the power series f.
Arccos(f) : RngSerElt -> RngSerElt
Given a power series f defined over the real or complex field, return the inverse cosine of the power series f.
Arctan(f) : RngSerElt -> RngSerElt
Given a power series f defined over a field of characteristic zero, return the inverse tangent of the power series f.

Hyperbolic Functions and their Inverses

Sinh(f) : RngSerElt -> RngSerElt
Given a power series f defined over a field, return the hyperbolic sine of the power series f. Return the hyperbolic sine of the power series f defined over a field.
Cosh(f) : RngSerElt -> RngSerElt
Given a power series f defined over a field, return the hyperbolic cosine of the power series f.
Tanh(f) : RngSerElt -> RngSerElt
Given a power series f defined over a field, return the hyperbolic tangent of the power series f.
Argsinh(f) : RngSerElt -> RngSerElt
Given a power series f defined over a field of characteristic zero, return the inverse hyperbolic sine of the power series f.
Argcosh(f) : RngSerElt -> RngSerElt
Given a power series f defined over the real or complex field, return the inverse hyperbolic cosine of the power series f.
Argtanh(f) : RngSerElt -> RngSerElt
Given a power series f defined over a field of characteristic zero, return the inverse hyperbolic tangent of the power series f.
 [Next][Prev] [Right] [Left] [Up] [Index] [Root]