An assorted selection of example calculations using Yacas
1. Show that Integrate(-Pi,Pi) (Sin(n*x)*Cos(m*x)) is Pi*Delta(n,m) :
In> Simplify(Integrate(x,-Pi,Pi)Sin(x)*Sin(2*x))
Out> 0
In> Simplify(Integrate(x,-Pi,Pi)Sin(2*x)*Sin(2*x))
Out> Pi
In> Simplify(Integrate(x,-Pi,Pi)Sin(5*x)*Sin(5*x))
Out> Pi
In> Simplify(Integrate(x,-Pi,Pi)Cos(x)*Cos(2*x))
Out> 0
In> Simplify(Integrate(x,-Pi,Pi)Cos(2*x)*Cos(2*x))
Out> Pi
In> Simplify(Integrate(x,-Pi,Pi)Cos(5*x)*Cos(5*x))
Out> Pi
In> Simplify(Integrate(x,-Pi,Pi)Sin(x)*Cos(2*x))
Out> 0
In> Simplify(Integrate(x,-Pi,Pi)Sin(2*x)*Cos(2*x))
Out> 0
In> Simplify(Integrate(x,-Pi,Pi)Sin(5*x)*Cos(5*x))
Out> 0
2. Get the first 5 coefficients of the Fourier series of x^2
on the domain -Pi to Pi. This should be (1/Pi)*Sum(n,0,4)a_n * Cos(n*x) :
In> Fourier(_n,_f)<--1/Pi*Integrate(x,-Pi,Pi)f*Cos(n*x)
Out> True
In> TableForm(Simplify(Table(Fourier(n,x^2),n,0,5,1)))
(2*Pi^2)/3
-4
1
-4/9
1/4
-4/25
Out> True
3. Check that f:=x*Exp(-x/2) is a solution to the equation H(f)=E f
where E is a constant and H is D(x)D(x)f + f/x :
In> H(f):=Deriv(x)Deriv(x)f+f/x
In> f:=x*Exp(-x/2)
In> res:=H(f)
In> PrettyForm(Simplify(res))
/ / x \ \
x * Exp| -| - | |
\ \ 2 / /
-----------------
4
In> PrettyForm(Simplify(res/f))
1
-
4
4. Show that the first few terms of the Taylor series expansion
of Sin(x) and Cos(x-Pi/2) are the same :
In> ans1:=Taylor(x,0,8)Sin(x)
In> PrettyForm(ans1)
3 5 7
x x x
x - -- + --- - ----
6 120 5040
In> ans2:=Taylor(x,0,8)Cos(x-Pi/2)
In> PrettyForm(ans2)
3 5 7
x x x
x - -- + --- - ----
6 120 5040
In> ans1-ans2
Out> 0
5. Determine a polynomial that goes through the points
(x,y) = { (-2,4), (1,1), (3,9) } and show that it is in fact x^2 :
In> ans:=LagrangeInterpolant({-2,1,3},{4,1,9},x)
In> PrettyForm(ans)
4 * ( x - 1 ) * ( x - 3 ) ( x - -2 ) * ( x - 3 )
------------------------- - ---------------------- +
15 6
9 * ( x - -2 ) * ( x - 1 )
--------------------------
10
In> PrettyForm(Simplify(ans))
2
x
5 examples shown