## Slope fields on the Sharp EL-8300C or EL-8200 Calculator

This program draws a 96-element (12 x 8) slope field in the rectangle [xmin,xmax]x[ymin,ymax]. The slopes are given by the function of x and y stored as f on the fourth line of the program.

General: To enter the program into the calculator, press the programming key (middle upper key), then C (which selects the NEW program option), then ENTER, then 1 (to select REAL mode), then the program name. The calculator will be in A-LOCK mode. Hit ALPHA at the end of the name, and then ENTER. After typing each command, press the ENTER key.

```Commands:  			Explanation and keying instructions

ClrG				Clears the screen. COMMAND (2ndF MATH),E,1
Goto start			This program begins with a subroutine
fn which gives the function of x and y
defining the slope. For Goto and Label
press COMMAND, then B for BRNCH menu;
Label fn			then 2 for Goto, 1 for Label.
f=-x/y				ONLY LINE to be changed for a new function
-x/y is only an example!! Note: f here is a
function of  both x and y.
Return				For Return, get to BRNCH  mode as above,
then press 5 key.
Label start			"start" is here.
h=7(-xmin+xmax)/83		Program will prompt for the unspecified
variables xmin,xmax,ymin,ymax. Remember
to use the (-) sign next to ENTER.
k=7(-ymin+ymax)/55		For /, press the division key, under the
the ) key. These instructions calculate the
x and y increments.
Range xmin,xmax,1,ymin,ymax,1	For Range, press COMMAND, then D for GRAPH
menu, then 4. This instruction will be
used when drawing the field.
a=1/(0.4h)^2			Instead of ^2 one can press the key
b=1/(0.4k)^2			left of the log key. The numbers a and b are
used in calculating how long the line segments
will be.
x=xmin+0.5h			These instructions locate the initial lower
z=ymin+0.5k			left-hand point.
i=1				Initializes the column count.
Label 1
j=1				Initializes the row count for each new column.
y=z
Label 2
Gosub fn
c=1/sqrt(a+b*f^2)		HERE, DO NOT ENTER THE LETTERS sqrt,
BUT INSTEAD PRESS THE KEY to the left
of the STO key!	Calculator will show a radical.
s=f*c				* is the multiplication key, under the
( key. The numbers c and s will give the
horizontal and vertical components of the line.
u=x
v=y
Line u-c,v-s,u+c,v+s		For Line press COMMAND,D,7 key. Note: comma
is on the . key, in ALPHA mode. Draws a
line centered at the current (x.y)
y=v+k				Move up in the column.
j=j+1
If j< =8 Goto 2			For If and Goto go to BRNCH mode as
before, then press 3 key for If and 2 key
for Goto. For < = press COMMAND, then C
for INEQ menu, then 3. Are we still in this
column? If so go back to "2".
x=u+h				Otherwise move over to next column.
i=i+1
If i< =12 Goto 1		Check if all columns are done.
DispG				Display graph: COMMAND (2ndF MATH),E,4

```
Running the program: Remember to re-edit when you switch functions, and that dy/dx = f(x,y) is a function of two variables. Then get to the program menu (upper middle key), choose A (for RUN menu), then right arrow, then down arrow to SLOPE, then ENTER. After graph is drawn, press ON key, then CL key.
If you move away from your picture and want to get back, make a 1-line program called "display" (say) with the istruction DispG (obtained as above).

Check: For f = -x/y get circles centered at the origin. The circles will be round if your screen parameters have the correct aspect ratio.
Check: For f = x+y and window [-3,3]x[-2,2], calculator screen should have the image shown on the right.

Anthony Phillips
Math Dept SUNY Stony Brook
tony@math.sunysb.edu
September 12 1997