{VERSION 5 0 "IBM INTEL LINUX" "5.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Headi ng 1" -1 3 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 8 4 1 0 1 0 2 2 0 1 }{PSTYLE "Maple Output" -1 11 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 3 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Title" -1 18 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 1 2 2 2 1 1 1 1 }3 1 0 0 12 12 1 0 1 0 2 2 19 1 } {PSTYLE "Normal" -1 256 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 18 "" 0 "" {TEXT -1 8 "PCMI-UFP" }}{PARA 18 "" 0 "" {TEXT -1 67 "LAB 5: The Diffusion Equation: Solution by Separation of Variables" }}{PARA 256 "" 0 "" {TEXT -1 14 "Janine Wittwer" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 3 "" 0 "" {TEXT -1 38 "Solving the Diffusion Equation given " }} {PARA 3 "" 0 "" {TEXT -1 29 "f(x) = 6 sin(15x) + 4/3sin(x)" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "restart;\nwith(plots):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "f:=x -> 6*sin(15*x) + 4/3*sin(x);\nplot(f (x), x=0..Pi);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 7 "Set k=1" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 58 "u:=(x,t)-> 6*exp(-15^2*t)*si n(15*x) + 4/3*exp(-t)*sin(x);\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 63 "ut:= diff(u(x,t),t);\nuxx:= diff(u(x,t),x$2);\nsimplify(ut-uxx );\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "plot3d(u(x,t), x=0. .Pi,t=0..0.02,numpoints=5000, axes=boxed);" }}}{EXCHG {PARA 3 "" 0 "" {TEXT -1 53 "Solving the Diffusion Equation given a Fourier Series" } {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart; " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "with(plots):\n" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 59 "f:= x -> sum((1/n)*sin(n*x), n=1..20);\nplot(f(x), x=0..Pi);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "u:=(x,t) -> sum((1/n)*sin(n*x)*exp(-n^2*t), n=1..20); \n" }{TEXT -1 50 "Here we set kappa = 1 in the differential equation" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "ut:= diff(u(x,t),t):\nuxx := diff(u(x,t),x$2):\nsimplify(ut-uxx);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "plot3d(u(x,t),x= 0..Pi, t=0..1, axes=boxed);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "animate(u(x,t),x=0..Pi, t=0..3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 3 "" 0 "" {TEXT -1 28 "Finding Fouri er Coefficients" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart: " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "with(plots):\nassume(n, integer ): assume(N,integer):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 52 "Set f and calculate its Fourier \+ coefficients for sin" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 92 "f:= x->(Pi- x)*x;\nplot(f(x),x=0..Pi);\n\na := [seq(int(f(x)*sin(n*x),x=0..Pi)*2/( Pi),n=1..20)];" }}{PARA 11 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 32 "Form the sin Fourier Series of f" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 56 "A:= x-> sum(a[k]*sin(k*x),k=1..20);\nplot(A (x), x=0..Pi);" }}}{EXCHG }{EXCHG {PARA 3 "" 0 "" {TEXT -1 74 "Solving the differential equation with the calculated Fourier Coefficients" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 69 "Form the solution to the Diffusi on Equation using the initial value f" }}{PARA 0 "" 0 "" {TEXT -1 8 "S et k=1\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 126 "u:= (x,t)-> su m(exp(-k^2*t)*a[k]*sin(k*x),k=1..20);\nanimate(u(x,t),x=0..Pi,t=0..1); \nplot3d(u(x,t),x=0..Pi,t=0..1, axes=boxed);" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 16 "One more example" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "r estart:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "with(plots):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "assume(n, integer): assume(N,intege r):\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 104 "f:= x->(sin(x))^2 + sin(3*x);\nplot(f(x),x=0..Pi);\n\nb := [seq(int(f(x)*sin(n*x),x=0..P i)*2/(Pi),n=1..20)];" }}{PARA 11 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 69 "Form the solution to the Diffusion Equation using the initial value g" }} {PARA 0 "" 0 "" {TEXT -1 8 "Set k=1\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 131 "u:= (x,t)-> sum(exp(-k^2*t)*b[k]*sin(k*x),k=1..20); \nanimate(u(x,t),x=0..Pi,t=0..0.5);\nplot3d(u(x,t),x=0..Pi,t=0..0.25, \+ axes=boxed);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "34" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 } {PAGENUMBERS 0 1 2 33 1 1 }