SLOPE FIELD - HP 48

Introduction
This program plots the slope field for the differential equation in the form ${\hbox{dy}\over \hbox{dx}}=\hbox{f(x,y)}$.
 
If you have not used one of the programs posted on this website before, you should read through the information in the Intro to Programming section first.


The Program
Note: The main program, SFLD, will call two subprograms, SUB1 and SUB2. All programs are given below.

<< RCLF  'flags'  STO
-19 SF -2 SF ERASE
{# 0d  # 0d} PVIEW
DRAX   PPAR   EVAL   4
DROPN OBJ  'Ymax' STO
'Xmax' STO OBJ 'Ymin'
STO 'Xmin' STO
'7 * (Xmax - Xmin) / 97'
NUM 'H' STO
'7 * (Ymax - Ymin) / 64'
NUM 'K' STO
'1 / (0.4 * H) ^ 2' NUM 'A'
STO '1 / (0.4 * K) ^ 2' NUM
'B' STO 0.5 H * Xmin +
'X' STO 0.5 K* Ymin +
'Z' STO 1 'I' STO SUB1
{C S Y J I Z T X B A
K H Xmin Ymin Xmax
Ymax} PURGE flags STOF
'flags' PURGE>>
ENTER 'SFLD' STO {This stores the program under variable name SFLD.}
<<1 'J' STO Z 'Y' STO
SUB2 X H  +  'X' STO
'I' INCR IF 20  <  THEN
SUB1 END>>
ENTER 'SUB1' STO {This stores the program under variable name SUB1.}
<<FUNC NUM 'T' STO
'1 /  (A + B * T ^ 2)' NUM           {The is the square root symbol}
'C' STO T C * 'S' STO
X C  -  Y S  - V2
X C  +  Y S  + V2
LINE Y K  +  'Y' STO
'J' INCR IF 10 < THEN
SUB2 END >>
ENTER 'SUB2' STO {This stores the program under variable name SUB2.}


Running the Program
 
You will need to enter a function  f(x,y) into a variable called FUNC before running the program. Follow the instructions in Intro to Programming if you have not done this before. Adjust the WINDOW accordingly before running the program.