Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Slope field and solutions program for TI calcs
Posted:
Jan 12, 1998 11:53 PM


Flow Fields and Solution Curves on TI Calculators This draws the flow field for dy\dx = Y1 PROGRAM: SLPFLD :10>L :18>W :(YmaxYmin)/L>V :(XmaxXmin)/W>H :ClrDraw :FnOff :PtOn(0,0) :0\>R :Ymin+V/2>Y :Lbl 1 :R+1>R :0>C :Xmin+H/2>X :Lbl 2 :C+1>C :Y\sub1>M :Y+M*H/3>T :YM*H/3>S :X+H/3>Q :XH/3>P :If abs(TS)>V :Goto 3 :Lbl 4 :Line(P,S,Q,T) :X+H\ra X :If C<W :Goto 2 :Y+V>Y :If R<L :Goto 1 :Return :Lbl 3 :Y+V/3>T :YV/3>S :(TY)/M+X>Q :(SY)/M+X>P :Goto 4 This program calls the preceding, and draws a solution curve through the cursor position each time you press [Enter]: PROGRAM:RKG :Disp "STEPS" :Input N :prgmSLPFLD :FnOff :Lbl G :Input :Y>B :X>A :(XmaxXmin)/N>H :0>U :Lbl R :If U=1 :H>H :A>X :B>Y :X>V :Y>W :Lbl Q :Y>Z :Line(V,W,X,Y) :X>V :Y>W :Z>Y :H*Y1>I :X+H/2>X :Z+I/2>Y :H*Y1>J :If abs(J)>1000000 :Goto F :Z+J/2>Y :H*Y1>K :X+H/2>X :Z+K>Y :H*Y1>L :Z+(I+2J+2K+L)/6>Y :If U=0 and X(< or =)Xmax :Goto Q :If U=1 and X(> or =)Xmin :Goto Q :If U=1 :Goto F :1>U :Goto R :Lbl F :Goto G NOTES: 0. Y1 denotes the variable "Y sub 1" on the TI82 and "y sub 1" on the TI85. 1. The program SLPFLD draws the slope or flow field for the differential equation dy/dx = Y1. 2. The program RKG calls SLPFLD to draw the flow field, then enables you to move the cursor to choose an initial point. When you press [ENTER], the program draws a solution curve passing through that point, using the RungaKutta algorithm. When the program starts, it asks for an input called "STEPS:"; this is comparable to the number of subdivisions in Simpson's rule or Euler's method. The more steps, the greater accuracy; using 50 is usually more than enough. 3. The programs SLPFLD and RKG will work as is on the TI82 calculator. The only change needed for the TI85 is to change X and Y to lower case: x and y. (This also means changing the function "Y sub 1" to "y sub 1") On the TI81 the program SLPFLD should work pretty much as is, except that the instruction :RETURN should be End; in RKG, the command SLPFLD should be replaced by Prgm?:SLPFLD which is gotten from the PRGM EXEC menu choice. 4. Programing words such as Disp, Goto, Lbl, Input should be entered from the menus provided on the various calculators; see the ``Table of Commands'' in the back of your instruction book to find which menu to use. For example, the symbols "< or =" and "==" (test for equals) can be gotten from the TEST menu. The variable Y1 is gotten from the YVARS menu on the TI82/82; on the TI85 you can get it from the vars menu, but it's easier to type it as: y1 (note lowercase y). Mark Bridger Math. Dept. Northeastern University BRIDGER@NEU.EDU



