Maple Commands for Quiz 6
--------------------------------------------------------------------------------
> v:='v':dsolve({diff(v(x),x$2)=0,D(v)(0)=-1},v(x));v:=rhs(");
v(x) = _C1 - x
v := _C1 - x
> a:=solve(subs(x=Pi,v)+2*subs(x=Pi,diff(v,x))=0,_C1);
a := Pi + 2
> v:=2+Pi-x;
v := 2 + Pi - x
-------------------------------------------------------------------------------
The eigenvalue problem associated with this partial differential
equation and these boundary conditions is:
d^2y/dx^2=lambda^2 y, 0 < x < pi
y^'(0)=0, y(pi) + 2y^'(pi) = 0.
This leads to the equation 1/(2*lambda) = tan(lambda*pi). The
corresponding eigenfunctions are cos(lambda*x). The eigenvalues are
the squares of these lambdas.
-------------------------------------------------------------------------------
> g:=1/(2*x)-tan(Pi*x);
1
g := --- - tan(Pi x)
2 x
> plot(g,x=0..5,y=-10..10,discont=true);
** Maple V Graphics **
> i:='i':for i from 1 to 4 do
> lambda[i]:=fsolve(g,x=i-1..i-1+.5); od;
lambda[1] := .3191611312
lambda[2] := 1.132356621
lambda[3] := 2.075257338
lambda[4] := 3.051693686
> f:=x-1-Pi;
f := x - 1 - Pi
> i:='1':for i from 1 to 4 do
> Int(f*cos(lambda[i]*x),x=0..Pi)/Int(cos(lambda[i]*x)^2,x=0..Pi);
> b[i]:=evalf("); od;
Pi
/
|
| (x - 1 - Pi) cos(.3191611312 x) dx
|
/
0
---------------------------------------
Pi
/
| 2
| cos(.3191611312 x) dx
|
/
0
b[1] := -3.145577630
Pi
/
|
| (x - 1 - Pi) cos(1.132356621 x) dx
|
/
0
---------------------------------------
Pi
/
| 2
| cos(1.132356621 x) dx
|
/
0
b[2] := -.6554995121
Pi
/
|
| (x - 1 - Pi) cos(2.075257338 x) dx
|
/
0
---------------------------------------
Pi
/
| 2
| cos(2.075257338 x) dx
|
/
0
b[3] := -.07340284283
Pi
/
|
| (x - 1 - Pi) cos(3.051693686 x) dx
|
/
0
---------------------------------------
Pi
/
| 2
| cos(3.051693686 x) dx
|
/
0
b[4] := -.1004180986
> i:='i':Sum(b[i]*cos(lambda[i]*x)*exp(-lambda[i]^2*t),i=1..4);apsol:=sum(b[i]*cos(lambda[i]*x)*exp(-lambda[i]^2*t),i=1..4);
4
-----
\ 2
) b[i] cos(lambda[i] x) exp(- lambda[i] t)
/
-----
i = 1
apsol := - 3.145577630 cos(.3191611312 x) exp( - .1018638277 t)
- .6554995121 cos(1.132356621 x) exp( - 1.282231517 t)
- .07340284283 cos(2.075257338 x) exp( - 4.306693019 t)
- .1004180986 cos(3.051693686 x) exp( - 9.312834353 t)
> uapprox:=apsol+v;
uapprox := - 3.145577630 cos(.3191611312 x) exp( - .1018638277 t)
- .6554995121 cos(1.132356621 x) exp( - 1.282231517 t)
- .07340284283 cos(2.075257338 x) exp( - 4.306693019 t)
- .1004180986 cos(3.051693686 x) exp( - 9.312834353 t) + 2 + Pi - x
-------------------------------------------------------------------------------
> p0:=plot(subs(t=0,uapprox),x=0..Pi):
-------------------------------------------------------------------------------
> p1:=plot(subs(t=1,uapprox),x=0..Pi):
> p5:=plot(subs(t=5,uapprox),x=0..Pi):
> p10:=plot(subs(t=10,uapprox),x=0..Pi):
> p15:=plot(subs(t=15,uapprox),x=0..Pi):
-------------------------------------------------------------------------------
> p20:=plot(subs(t=20,uapprox),x=0..Pi):
> with(plots):txt:=textplot({[.2,1.2,`t=0`],[.3,2.1,`t=1`],[.5,3.1,`t=5`],[.2,4.8,`t=20`]}):
-------------------------------------------------------------------------------
> display({p0,p1,p5,p10,p15,p20,txt});
** Maple V Graphics **
-------------------------------------------------------------------------------