:

## another FourierSeries package for Maple

Yet another Fourier series package? This package provides new data structure for the representation of trigonometric series and few procedures to work with trigonometric series and to compute Fourier series. Some procedures and data structure are similar to OrthogonalSeries package (but not the same).

>

> libname:=libname, `.`:

> with(FourierSeries);

>

Usage of the procedure Create is similar to OrthogonalSeries[Create] but there are few differences.

> s:=Create({[1,2,3], n}, SinTrigP(n,x));

> type(s, FOURIERSERIES);

There are four types of orthogonal systems: SinTrigP, CosTrigP, CosSinTrigP and ExpTrigP2. ExpTrigP2 means that the series is defined as a sum which goes from the zero to the plus infinity (and not from the minus infinity to the plus infinity).

> Create({[1,2,3], n}, CosTrigP(n,x));

Creating series with different period.

> Create({[1,2,3], n}, CosTrigP(n,x), Pi);

When creating the series with both sine and cosine terms, the coefficients are specified by a list of pairs. Also it is necessary to use the option "general" to set the general coefficient of the series.

> s:=Create({[1,[1,-1],[1/2,-1/2]], 'general'=[n,-n]}, CosSinTrigP(n,x));

Some other possibilities to specify the coefficients (see OrthogonalSeries[Create]):

> Create({[1,[1,-1],[1/2,-1/2]]}, CosSinTrigP(n,x));

> Create({[0=1,1=[1,-1],3=[1/2,-1/2]], 'general'=n, n=5..10}, CosSinTrigP(n,x));

> Create({[0=1,1=[1,-1],3=[1/2,-1/2]], 'general'=n, n=5..10}, ExpTrigP2(n,x));

The data structure of the type FOURIERSERIES:

> lprint(s);

FourierSeries:-FOURIERSERIES(S)

> print(op(1,s));

Converting to the regular sum

> ConvertToSum(s);

> lprint(%);

1+cos(x)-sin(x)+1/2*cos(2*x)-1/2*sin(2*x)+Sum(n*cos(n*x)-n*sin(n*x),n = 3 .. infinity)

Derivate the series

> s2:=Derivate(s);

> Evaluate(s, x=Pi/4);

> Evaluate(s, x=Pi/4, trunc=5);

> Evaluate(s, x=A, trunc=5);

Conversion between orthogonal systems.

> s2;

> ChangeBasis(s2, `ExpTrigP2`(n,x));

> ChangeBasis(%, `SinTrigP`(n,x));

Operators `+`, `-`, `*` and `/` are overloaded. It is possible to add/subtract the series or to multiply a series by a real constant. But we can also use the procedure Add or ScalarMultiply.

> -s2;

> s2+2;

> s2/3;

> s3:=ScalarMultiply(s2, (1-alpha));

Getting the coefficients and the degree.

> s;

> Coefficients(s,5);

> Degree(s3);

> Truncate(s3,7);

> Degree(%);

Copying the series

> s4:=Copy(s3);

Computing the Fourier series of the given function.

> GetFourierSeries(cos(x)^4,x=-Pi..Pi);

> GetFourierSeries(x+signum(x),x=-Pi..Pi);

Getting the partial sum.

> t:=Truncate(%, 4);

> ConvertToSum(t);

Change the orthogonal system.

> ChangeBasis(t, `ExpTrigP2`(n,x));

> Diff(y(x),x\$2)+2*y(x)=Sum(sin(n*x)/n^4,n=1..infinity);

> S1:=Create({,'general'=[0,1/n^4]}, CosSinTrigP(n,x));

Create the general series

> S2:=Create({[a0], 'general'=[aN,bN]}, CosSinTrigP(n,x));

Derivate the series two times

> Derivate(Derivate(S2))+2*S2=S1;

Subtract the series

> S:=lhs(%)-rhs(%);

> type(S, FOURIERSERIES);

Series S should have all coefficients equal to zero. Hence a0 = 0.

Get the general coefficient.

> Coefficients(S);

> {%=0, %=0};

> solve(%, {aN, bN});

Create the solution.

> Y:=Create({subs(%, bN)}, SinTrigP(n,x));

Check the solution

> Derivate(Derivate(Y))+2*Y;

> SimplifyCoefficients(%, simplify);

> ﻿