1.10 SeriesΒΆ
FriCAS also provides power series. By default, FriCAS tries
to compute and display the first ten elements of a series. Use
)set streams calculate
to change the default value to something else.
For the purposes of this document, we have used this system command to
display fewer than ten terms. For more information about working with series,
see ugProblemSeries.
You can convert a functional expression to a power series by using the
operation series
. In this example, sin(a*x) is expanded in powers of
(x-0), that is, in powers of x.
series(sin(a*x),x = 0)
Type: UnivariatePuiseuxSeries(Expression Integer,x,0)
This expression expands sin(a*x) in powers of (x - %pi/4).
series(sin(a*x),x = %pi/4)
Type: UnivariatePuiseuxSeries(Expression Integer,x,pi/4)
FriCAS provides Puiseux series with rational number exponents. The first
argument to series is an in-place function that computes the n-th coefficient.
(Recall that the +->
is an infix operator meaning maps to.)
series(n +-> (-1)^((3*n - 4)/6)/factorial(n - 1/3),x=0,4/3..,2)
Type: UnivariatePuiseuxSeries(Expression Integer,x,0)
Once you have created a power series, you can perform arithmetic operations on that series. We compute the Taylor expansion of 1/(1-x). series:Taylor
f := series(1/(1-x),x = 0)
Type: UnivariatePuiseuxSeries(Expression Integer,x,0)
Compute the square of the series.
f ^ 2
Type: UnivariatePuiseuxSeries(Expression Integer,x,0)
The usual elementary functions ( log, exp, trigonometric functions, and so on) are defined for power series.
f := series(1/(1-x),x = 0)
Type: UnivariatePuiseuxSeries(Expression Integer,x,0)
g := log(f)
Type: UnivariatePuiseuxSeries(Expression Integer,x,0)
exp(g)
Type: UnivariatePuiseuxSeries(Expression Integer,x,0)
Here is a way to obtain numerical approximations of e from the Taylor series expansion of exp(x). First create the desired Taylor expansion.
f := taylor(exp(x))
Type: UnivariateTaylorSeries(Expression Integer,x,0)
Evaluate the series at the value 1.0. As you see, you get a sequence of partial sums.
eval(f,1.0)
Type: Stream Expression Float