HP Prime: Slopefield (Differential Equations)
12-05-2015, 05:11 AM (This post was last modified: 12-05-2015 05:12 AM by Eddie W. Shore.)
Post: #1
 Eddie W. Shore Senior Member Posts: 1,134 Joined: Dec 2013
HP Prime: Slopefield (Differential Equations)
HP Prime: Slopefield (Differential Equations)
Adopted from Alan Ziv’s Casio program – ported to the HP Prime

http://edspi31415.blogspot.com/2015/12/h...ntial.html

Program:
Code:

EXPORT SLOPEFIELD(dxy)
BEGIN
// dxy: dx/dy = f′(x,y)
// Adopted from Alan Ziv -
// Casio
// dxy is in quotes
LOCAL X,Y,C,D,J,K,G,H;
LOCAL F,xa,xb,ya,yb,E;

// Use the Function App
RECT();
C:=(Ymax-Ymin)/220;
D:=(Xmax-Xmin)/320;

FOR J FROM 0 TO 50 DO
E:=Xmin+(8*J+3)*D;
FOR K FROM 0 TO 27 DO
F:=Ymin+(8*K+3)*C;

X:=E;
Y:=F;
G:=EXPR(dxy);
H:=2*D;

IF ABS(G)>C/D THEN
H:=2*C/ABS(G);
END;

IF 2*H>D THEN
xa:=E-H; ya:=G*(xa-E)+F;
xb:=E+H; yb:=G*(xb-E)+F;
LINE(xa,ya,xb,yb);
ELSE
LINE(E,F+2*C,E,F-2*C);
END;
END;
END;

// Draw Axis
LINE(Xmin,0,Xmax,0,#C0C0C0h);
LINE(0,Ymin,0,Ymax,#C0C0C0h);
WAIT(0);

END;
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)