MAPLE Worksheet: MAPLE_Lab1.mw
Math 115
LAB 1: Verifying and Visualizing Solutions to PDE's
Andrew J. Bernoff
Harvey Mudd College
A Solution to the Convection Equation
| > | restart: |
| > | with(plots): |
| > | F:=x->exp(-x^2); |
| > | plot(F(x),x=-2..2); |
![]() |
| > | u:=F(x-c*t); |
| > | ut:=diff(u,t);ux:=diff(u,x); |
| > | PDE:=ut+c*ux;simplify(PDE); |
| > | c:=1;u; |
| > | u1:=subs(t=0,u);u2:=subs(t=1,u);u3:=subs(t=2,u); |
| > | plot({u1,u2,u3},x=-5..5,color=[red,blue,green]); |
![]() |
| > | plot3d(u,x=-6..6,t=0..2,axes=boxed); |
![]() |
| > | animate(u,x=-6..6,t=0..2); |
![]() |
A Solution to Laplace's Equation
| > | restart: |
| > | with(plots): |
| > | Phi:=exp(-x)*cos(y); |
| > | Phi_xx:=diff(Phi,x$2);Phi_yy:=diff(Phi,y$2); |
| > | PDE:=Phi_xx+Phi_yy; |
| > | plot3d(Phi,x=0..1,y=0..2*Pi,axes=frame); |
![]() |
A Fourier Series
| > | restart: |
| > | with(plots): |
| > | h:=N->2*sum((-1)^(m+1)*sin(m*x)/m,m=1..N); |
| > | h2:=h(2);h4:=h(4);h8:=h(8);h16:=h(16);h32:=h(32); |
| > | plot({x,h2,h4,h8,h16,h32},x=0..Pi); |
![]() |
| > |