WPC 2BPZCourier 10cpi3|I=jx6X@8QX@HP LaserJet 500+HPLAS500.PRSx6X@8Q,80!|X@01-25-96 06:32p E:\WP51\MATH142\SLPF2.PRG TI85 Program TI85 program to produce slope fields for functions of two variables x and y. !(#%'0*,.8135@8:o9gC0,g [ PXPBp4^=,,%{^ [ P&P q3_=,,J_~> p &r8gC0,ng~> p Xsw0V8(,~V [ PPty.S8(,}S `> xXul*M2$,+XM [ PPvl*M2$,ΛWM~> p Vx/U8(,&}U~> p   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFG2 xP  #g [ PXP##~V [ PP# XX,8  $TI85 Program for Slope Fields Functions of Two Variables (SLPF2) DJTI85 Program for Slope Fields` (#tPage D XX  6Math 142 Spring Semester 1996  xP 2@Dr. Carruth ă #^ [ P{&P##~V [ PP# 1. :.5Cd d $ *Reduction factor for portion of rectangles covered by line segments (C1). ƀ% 2. :ClDrwd d $ *Clear any drawing that might reside on the graphing screen.ƀ% 3. :FnOffd d $ *Unselect any functions (Y1Y99) for graphing.ƀ% 4. :Disp "Enter F(x,y)"d d $ *Display the prompt to enter the function.ƀ% 5. :InpSt FUNCTIONd d $ *Command InpSt for accepting function input as a string.ƀ% 6. :StEq(FUNCTION,F) *Command StEq converts the "string" function to a "real" function.ƀ% 7. :Disp "Enter xMin"d d $ *Display the prompt to enter the lower limit for x values.ƀ% 8. :Input xMind d $ *Command Input accepts the input value for the variable xMin.ƀ% 9. :Disp "Enter xMax"d d $ *Display the prompt to enter the upper limit for x values.ƀ% 10. :Input xMaxd d $ *Command Input accepts the input value for the variable xMax.ƀ% 11. :Disp "Enter yMin"d d $ *Display the prompt to enter the lower limit for y values.ƀ% 12. :Input yMind d $ *Command Input accepts the input value for the variable yMin.ƀ% 13. :Disp "Enter yMax"d d $ *Display the prompt to enter the upper limit for y values.ƀ% 14. :Input yMaxd d $ *Command Input accepts the input value for the variable yMax.ƀ% 15. :Disp "Enter Nx"d d $ *Display the prompt to enter the number of horizontal line segments to use.ƀ% 16. :Input NXd d $ *Command Input accepts the value Nx for the variable NX.ƀ% 17. :Disp "Enter Ny"d d $ *Display the prompt to enter the number of vertical line segments to use.ƀ% 18. :Input NYd d $ *Command Input accepts the value Ny for the variable NY.ƀ% 19. :(xMaxxMin)/NXHpd d $ *Calculating the width of horizontal intervals and assigning it to the variable H.ƀ%d 20. :(yMaxyMin)/NYVd d $  *Calculating the height of vertical intervals and assigning it to the variable V.ƀ% 21. :1Id d $ *Starting the Iloop by setting I=1 (first row).ƀ%  yQ 22. :Lbl Ad d $ *Establishing a label for the subroutine (for Goto) to #}S `> xX#move up the rows#~V [ PP#.ƀ% 23. :1Jd d $ *Starting the Jloop by setting J=1 (first column).ƀ%  yQ 24. :Lbl Bd d $ *Establishing a label for the subroutine (for Goto) to #}S `> xX#move across the columns#~V [ PP#.ƀ% 25. :xMin+(J1)*H+H/2x *Calculating the xcoordinate of the center of the (I,J) rectangle.ƀ% 26. :yMin+(I1)*V+V/2y *Calculating the ycoordinate of the center of the (I,J) rectangle.ƀ% 27. :FMd d $ *Evaluating F(x,y) at the point (x,y) and assigning the value to the variable M (slope).ƀ% 28. :yM*C*H/2Sd d $ *Determining the ycoordinate of the left endpoint of the slope line segment (S).ƀ% 29. :y+M*C*H/2Zd d $ *Determining the ycoordinate of the right endpoint of the slope line segment (Z).ƀ% 30. :xC*H/2Pd d $ *Determining the xcoordinate of the left endpoint of the slope line segment (P).ƀ% 31. :x+C*H/2Qd d $ *Determining the xcoordinate of the right endpoint of the slope line segment (Q).ƀ% 32. :If abs (ZS)>C*Vd d $ *Checking to see if the difference in ycoordinates is too large (want C*V).ƀ% 33. :Goto Dd d $ *If the difference in ycoordinates is too large, go to Lbl D to scale it down.ƀ% 34. :Lbl Ed d $ *If the difference in ycoordinates is OK, plot the line segment joining (P,S) to (Q,Z).ƀ% 35. :Line(P,S,Q,Z)d d $ *Sketching the slope field line segment in the (I,J) rectangle.ƀ% 36. :IS>(J,NX)d d $ *Testing to see if J has reached NX. If not, add 1 to J. Otherwise skip the next step.ƀ% 37. :Goto Bd d $ *J has been increased by 1 (next rectangle/column in Row I) repeat subroutine B.ƀ% 38. :IS>(I,NY)d d $ *Testing to see if i has reached NY. If not, add 1 to I. Otherwise skip the next step.ƀ% 39. :Goto Ad d $ *I has been increased by 1 (next row up) repeat subroutine A for this row.ƀ% 40. :Stopd d $ *End of program. While it has been running, the slope field graph has been generated.ƀ% 41. :Lbl Dd d $ *Subroutine to scale down the vertical portion of line segments if they are too large.ƀ%  wQ,# 42. :yV/2Sd d $ *Making the ycoordinates of the left endpoint lie on the upper or lower edges.  * ƀ%  wQ# 43. :y+V/2Zd d $  *Making the ycoordinates of the right endpoint lie on the upper or lower edges.  * ƀ% 44. :(Sy)/M+xPd d $ *Rescaling the xcoordinate of left endpoint to keep the slope = M after adjusting S.ƀ% 45. :(Zy)/M+xQpd d $ *Rescaling the xcoordinate of right endpoint to keep the slope = M after adjusting Z.ƀ%d 46: :Goto Ed d $ *Going back to sketching the slope field line segment in the (I,J) rectangle after rescaling.ƀ%  wQ'   *  If M is positive the left endpoint will lie near the lower edge, whereas if M is negative, the left endpoint will lie near the upper edge.ƀ%  xP4*  Note:The symbol  represents STO on the calculator, but it appears as  on the edit screen.  xP*  Note:  This program may be transferred from my calculator to yours!  xP+ Note:If you set Nx>12 and/or Ny>8, be prepared for a slow graph generation!  xQT-  Warning: 8When addressing the first question asked in class on Wednesday, March 13, 1996, it is not enough to reset the H/2 values in Steps 2528 to adjust the xcoordinates of endpoints of slope field line segments. One must also adjust the rescaling of ycoordinates of these endpoints both in the conditional statement in Step 29 and in Subroutine D. Otherwise, an accurate slope field will not be generated by the program.ƀ%/,1,1,1,,Ԍ lK ԙ#XM [ P+P#E:\WP51\MATH142\SLPF2.PRG 03/15/1996 10:10 A.M.