{VERSION 2 3 "IBM INTEL NT" "2.3" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Helvetica" 0 12 0 0 0 1 2 2 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R 3 Font 0" -1 256 1 {CSTYLE "" -1 -1 "Helvetica" 0 12 0 0 255 1 2 2 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 2" -1 257 1 {CSTYLE "" -1 -1 "Courier" 0 11 0 128 128 1 2 1 2 0 0 0 0 0 0 } 0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT -1 19 "Easy2.mws 7/22/97" }} {PARA 0 "" 0 "" {TEXT -1 23 "=======================" }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 5 "loops" }}{PARA 0 "" 0 " " {TEXT -1 11 "derivatives" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "restart; wi th(plots):" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 59 "We illustrate the solution of two equations in two unknow ns" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "s:=solve(\{3*x+4*y=3, 3*x-3*y=7\},\{x,y\});x;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 76 "After the solution, maple doesn't \+ know what x is. x has not been 'assigned'" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 12 "assign(s);x;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 71 "Now maple knows x and y. (And they are no longer free to be variab les.)" }}{PARA 0 "" 0 "" {TEXT -1 78 "Assigning a solution is importan t if something is to be done with x & y later." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 79 "Next, we illustrate the u se of a loop. Everything between the 'do' and the 'od'" }}{PARA 0 "" 0 "" {TEXT -1 75 "gets executed the specified number of times. Be sure to include the 'od' at" }}{PARA 0 "" 0 "" {TEXT -1 53 "the end, or yo ur whole maple session can get wrecked." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "h:=0: for k from 1 to \+ 10 do h:=h+k: od: h;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 146 "Here is a more complicated use of loops; a tot al charge of 1 nC in N even chunks from -1 m to +1m along the x-axis. \+ We will plot along the y-axis." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 127 "First, we need a function for the potent ial, with q in nC.\nThis is the potential due to a charge q at (a,0,0) at point (x,y,z)." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "V:=9*q/sqrt((x-a)^2+y^2+z^2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 61 "Oops, x a nd y are committed, so we free them up and go again." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "x:='x';y:='y';" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "V:=9*q/sqrt((x-a)^2+y^2+z^2);" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 64 "Now we break 1 nC \+ into 6 pieces and place from -1 to 1, roughly." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 76 "I often forget the gramma r of the loop, so I get reminded by asking for help" }}{PARA 0 "" 0 " " {TEXT -1 74 "on the 'for' statement. One of the examples in the help shows going by 2's" }}{PARA 0 "" 0 "" {TEXT -1 67 "as I did below. No te that the subs command plays an important role." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "?for;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "V6pcs:=0; # break charge into 6 chu nks" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "for k from -5 to 5 b y 2 do " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 90 "V6pcs:=V6pcs+subs(q=1/6, a=k/6,x=0,z=0,V): # a runs from -2.5/3 to +2.5/3 along x-axis" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "od: V6pcs;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "plot(V6pcs,y=0.. 4,title=` 6 pieces from -1 to 1`);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 72 "Now break the 1 nC into 12 piec es and spread them over the same range. " }}{PARA 0 "" 0 "" {TEXT -1 42 "Will V at the origin be bigger or smaller?" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "V12pcs:=0: # break charge into 12 chunks" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "for k fro m -11 to 11 by 2 do " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 89 "V12pcs:=V12 pcs+subs(q=1/12,a=k/12,x=0,z=0,V): # a runs from -5.5/6 to +5.5/6 alon g x-axis" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "od: V12pcs:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "plot(V12pcs,y=0..2,title=`12 pieces from -1 to 1`);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 173 "The two grap hs should differ a little at y=0 and then rapidly come together at lar ger values of y, because we have the same total charge spread over the same total distance." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 65 "plot(\{V6pcs,V12pcs\},y=0..4,title=`6 and 12 chu nks from -1 to 1`);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 25 "Now for some derivatives." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 76 "We find the laplacian of \+ the V function, then simplify it to show it's zero." }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "laplacian:=diff(V ,x,x)+diff(V,y$2)+diff(V,z,z);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "simplify(laplacian);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "z:=2*x^3*exp(-x); # function" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "dzdx:=diff(z,x); # derivative" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 48 "solve(dzdx=0,x); # find where derivative is ze ro" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "plot(z,x=0..6); # plo t and see that it agrees" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 52 "z:='z'; # a command to stop and let us see the graph" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 22 "Exercises for the user" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 109 "1. A ball is thrown straight up. The ball's height as a \+ function of time is given by y(t) = 6 + 50*t -16t^2. " }}{PARA 0 "" 0 "" {TEXT -1 49 "a) Plot this function to see if it is reasonable." }} {PARA 0 "" 0 "" {TEXT -1 163 "b) Obtain the derivative of y with respe ct to time. Plot it and verify that it is positive while the ball is g oing up to the highest point and negative thereafter." }}{PARA 0 "" 0 "" {TEXT -1 164 "c) Before doing any calculations, predict the nature \+ of the vertical acceleration as a function of the time. Then do the ca lculation and compare to your prediction." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 93 "2. The expression for the magnetic field on the axis of a circular loop , radius R, current I" }}{PARA 0 "" 0 "" {TEXT -1 51 "at a distance z \+ from the center (along the axis) is" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "Bz:=km*Pi*i*R^2/(z^2+R^2) ^(3/2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 78 "a) Show there is a max at z=0 by plotting. Set R=1, I=1 , km=1 and plot vs z." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "Bz 1:=subs(km=1,R=1,i=1,Bz);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "plot(B z1,z=-2..2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 " " {TEXT -1 53 "b) Find the 2nd derivative, and find where it is zero" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "Bz2:=diff(Bz,z,z); # 2nd \+ derivative" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "solve(Bz2=0,z);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 74 "c) Create a Helmholtz coil (2 coils whose inflection points are the same , " }}{PARA 0 "" 0 "" {TEXT -1 70 "coil separation is twice the distan ce from center to inflection point." }}{PARA 0 "" 0 "" {TEXT -1 0 "" } }{PARA 0 "" 0 "" {TEXT -1 71 "3. You are defending against incoming pr otons of KE 20,000 eV. You have" }}{PARA 0 "" 0 "" {TEXT -1 62 "a tota l charge of 500 nC to defend a 1-m wide region of space." }}{PARA 0 " " 0 "" {TEXT -1 70 "a) [Students:] Show that the potential must be >20 ,000 V to do the job" }}{PARA 0 "" 0 "" {TEXT -1 75 "b) Show that a si ngle charge in the middle won't do the job (use subs cmd)." }}{PARA 0 "" 0 "" {TEXT -1 67 "c) Try half the charge at the 1/3 and 2/3 points \+ (use subs command)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "Vcent er:=subs(q=500,a=1/2,y=0,z=0,V);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "plot(Vcenter,x=0..1,y=0..30000);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 191 "4 . [loop and subs problem] Find the potential at x=10 m from a group of 20 charges, each 5 nC, distributed uniformly from 0 to 10 m. [Student s, estimate the answer before doing calculations!]" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 39 "end of easy2=================== ========" }{MPLTEXT 1 0 0 "" }}}}{MARK "0 0 0" 19 }{VIEWOPTS 1 1 0 1 1 1803 }