{VERSION 3 0 "DEC ALPHA UNIX" "3.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 } {PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple Output" 0 11 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 3 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple Plot" 0 13 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT -1 91 "This Maple code attempts t o solve Physics 442 problem 1.04, the magnetic diffusion problem." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "restart:with(plots):" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 71 "Define the constants that we will use for copper and a 1 mm radius wire" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "s igma:=1/1.68e-8;mu:=4*Pi*1e-7;a:=.001;Eo:=1;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%&sigmaG$\"+_4Q_f!\"#" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#muG,$%#PiG$\"\"%!\"(" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"aG$ \"\"\"!\"$" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#EoG\"\"\"" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 97 "Now calculate the diffusion time so we wi ll know over what time scale to plot the solutions later" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "diffuse:=1/(mu*sigma);tau:=a^2/diffuse;" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#>%(diffuseG,$*&\"\"\"F'%#PiG!\"\"$\"++ +++U!#6" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$tauG,$%#PiG$\"+\"Q_4Q#!# 9" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 110 "We now need the zeroes of t he Jo Bessel functions. Fortunately, online help tells us that they a re given by a" }}{PARA 0 "" 0 "" {TEXT -1 111 "Maple function, Bessel JZeros(order,n), where order is 0 for Jo. It will make the code look \+ less ugly later if" }}{PARA 0 "" 0 "" {TEXT -1 64 "these values are de fined in terms of a simple function named j0n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "j0n:= n ->BesselJZeros(0,n);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$j0nGR6#%\"nG6\"6$%)operatorG%&arrowGF(-%-BesselJZero sG6$\"\"!9$F(F(F(" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 18 "Make sure it works" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "evalf(j0n(1)); # OK" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#$\"+eb#[S#!\"*" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 76 "Now define the function gamma(n) that gives values \+ that go with these zeros" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "gam:= n -> j0n(n)^2/(mu*sigma*a^2);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$gam GR6#%\"nG6\"6$%)operatorG%&arrowGF(*&*$)-%$j0nG6#9$\"\"#\"\"\"F4*(%#mu G\"\"\"%&sigmaG\"\"\")%\"aG\"\"#F4!\"\"F(F(F(" }}}{EXCHG {PARA 11 "" 1 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 89 "Now define a function An(n) which gets the coefficients in the sum for the magneti c field" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "An:= n -> -2*sigma*Eo/(j 0n(n)*BesselJ(1,j0n(n)))*mu*a/j0n(n);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#AnGR6#%\"nG6\"6$%)operatorG%&arrowGF(,$*&**%&sigmaG\"\"\"%#EoGF0 %#muGF0%\"aGF0\"\"\"*&)-%$j0nG6#9$\"\"#F4-%(BesselJG6$F0F7\"\"\"!\"\"! \"#F(F(F(" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 85 "Now we define the fu nction Jz(rho,t), where rho=r/a by doing the Bessel function sum." }} {PARA 0 "" 0 "" {TEXT -1 95 "The number of terms needed varies with t, but 20 is enough for the plots I do below. The later" }}{PARA 0 "" 0 "" {TEXT -1 87 "in time you plot the fewer you need and the earlier \+ in time you plot the more you need." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 95 "Jz:=(rho,t)-> sigma*Eo + sum(j0n(n)/(mu*a)*An(n)*BesselJ(0,j0n(n)* rho)*exp(-gam(n)*t),n=1..20);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#Jz GR6$%$rhoG%\"tG6\"6$%)operatorG%&arrowGF),&*&%&sigmaG\"\"\"%#EoGF0F0-% $sumG6$*&**-%$j0nG6#%\"nG\"\"\"-%#AnGF9F0-%(BesselJG6$\"\"!*&F7F09$F0F 0-%$expG6#,$*&-%$gamGF9F09%F0!\"\"F0F;*&%#muG\"\"\"%\"aG\"\"\"!\"\"/F: ;F0\"#?F0F)F)F)" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 55 "We also define the magnetic field function the same way" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 94 "Bphi:=(rho,t)-> sigma*Eo*mu/2*a*rho + sum(An(n)*Besse lJ(1,j0n(n)*rho)*exp(-gam(n)*t),n=1..20);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%%BphiGR6$%$rhoG%\"tG6\"6$%)operatorG%&arrowGF),&*,%&s igmaG\"\"\"%#EoGF0%#muGF0%\"aGF09$F0#F0\"\"#-%$sumG6$*(-%#AnG6#%\"nGF0 -%(BesselJG6$F0*&-%$j0nGF=F0F4\"\"\"F0-%$expG6#,$*&-%$gamGF=F09%F0!\" \"F0/F>;F0\"#?F0F)F)F)" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 62 "Define \+ the times at which to look at the curves of Jz and Bphi" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 106 "times:=array(1..5):times[1]:=.01*tau;times[2] :=.05*tau;times[3]:=.1*tau;times[4]:=.3*tau;times[5]:=.6*tau;" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#>&%×G6#\"\"\",$%#PiG$\"+\"Q_4Q#!# ;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>&%×G6#\"\"#,$%#PiG$\"+\">w/ >\"!#:" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>&%×G6#\"\"$,$%#PiG$\"+ \"Q_4Q#!#:" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>&%×G6#\"\"%,$%#PiG $\"+Vr&G9(!#:" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>&%×G6#\"\"&,$%# PiG$\"+H9dG9!#9" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 71 "Finally, it's \+ time to plot this function for various times of order tau" }}{PARA 0 " > " 0 "" {MPLTEXT 1 0 76 "for m from 1 to 5 do pn[m]:= plot(Jz(rho,tim es[m]),rho=0..1,0..sigma*Eo) od:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 52 "display(\{pn[1],pn[2],pn[3],pn[4],pn[5]\},axes=boxed) ;" }}{PARA 13 "" 1 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 30 "And now plot Bphi the same way" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 85 "for m from 1 to 5 do bn[m]:= plot(Bphi(rho,times[m]),rho=0..1,0. .sigma*Eo*mu*a/2) od:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 52 "di splay(\{bn[1],bn[2],bn[3],bn[4],bn[5]\},axes=boxed);" }}{PARA 13 "" 1 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "9 2 0" 87 } {VIEWOPTS 1 1 0 3 2 1804 }