[comp.sys.handhelds] DIFFERENTIAL EQUATIONS ON THE HP48SX

gt3398b@prism.gatech.EDU (DELANO,ANDREW DOUGLAS) (10/12/90)

Here are some programs I wrote to do Euler's method, Improved
Euler's method, Taylor series method, and Runge Kutta method
for solving differential equations on the 48.  They were very
useful in this quarters diffeqs class.  I hope somebody else
out there finds them helpful.  I didn't know of any other progams
like these existing so I wrote them myself.  If anybody else
has any improvements, suggestions, or questions, please email
me.  Also if I would be interested to know how many of you like
them so if you do use them, please let me know.  Maybe somebody
can put these on an ftp site for those who miss this.  Anyway,
here are some genral instructions and the programs.


1. Download this directory into your hp48sx. (name it what you wish).

2. There are 6 programs: EULR1,EULR2,TAYLr,R.K.,ENTR,PLT. You can
   use EULR1, EULR2, TAYLr, and R.K. to solve equations.  ENTR and
   PLT are utilities.

3. Just press the method you wish and follow instructions.

                 GOOD LUCK

			Andy Delano

Here is the directory:

_________________________________________________________________________

%%HP: T(3)A(D)F(.);
DIR
  EULR1
    \<< ENTR
      DO DE EVAL h
* Y + DUP 'Y' STO X
h + 'X' STO X SWAP
{ 1 2 } \->ARRY \GS+
      UNTIL X S ==
      END { X Y DE
h S IV XS } PURGE
PLT
    \>>
  EULR2
    \<< ENTR
      DO DE EVAL
DUP h * Y + Y SWAP
'Y' STO X h + 'X'
STO DE EVAL SWAP
'Y' STO X h - 'X'
STO + h 2 / * Y +
DUP 'Y' STO X h +
'X' STO X SWAP { 1
2 } \->ARRY \GS+
      UNTIL X S ==
      END { X Y DE
h S IV XS } PURGE
PLT
    \>>
  TAYLr
    \<< ENTR
      DO DE 'X' \.d
DE 'Y' \.d DE EVAL *
+ h 2 ^ 2 / * DE
EVAL h * + Y + DUP
'Y' STO X h + 'X'
STO X SWAP { 1 2 }
\->ARRY \GS+
      UNTIL X S ==
      END { X Y DE
h S IV XS } PURGE
PLT
    \>>
  R.K.
    \<< ENTR
      DO DE EVAL
'K1' STO h .5 * X +
'X' STO Y DUP .5 h
* K1 * + 'Y' STO DE
EVAL 'K2' STO DUP
.5 h * K2 * + 'Y'
STO DE EVAL 'K3'
STO .5 h * X + 'X'
STO DUP h K3 * +
'Y' STO DE EVAL
'K4' STO 'Y' STO X
h - 'X' STO K1 2 K2
* 2 K3 * K4 + + + h
6 / * Y + 'Y' STO X
h + 'X' STO X Y { 1
2 } \->ARRY \GS+
      UNTIL X S ==
      END { K4 K3
K2 K1 X Y DE h XS S
IV } PURGE PLT
    \>>
  ENTR
    \<<
"Enter Equation
y'=:"
"''" INPUT
"Enter Step Size (h):"
"" INPUT
"Enter X Startpoint:"
"" INPUT
"Enter X Endpoint:"
"" INPUT
"Enter Intial
Value(X,Y):"
"()" INPUT OBJ\->
'IV' STO OBJ\-> 'S'
STO OBJ\-> 'XS' STO
OBJ\-> 'h' STO OBJ\->
'DE' STO IV V\-> 'Y'
STO 'X' STO '\GSDAT'
PURGE X Y { 1 2 }
\->ARRY \GS+ XS 'X' STO
CLLCD
"    Please Wait..."
2 DISP 0 FREEZE
    \>>
  PLT
    \<<
"Would you like
to plot the results?
(Y/N)"
"" INPUT 'a' STO
      IF a "Y" ==
      THEN ERASE
SCATRPLOT GRAPH
      ELSE
      END \GSDAT {
\GSPAR PPAR a } PURGE
    \>>
END
-- 
DELANO,ANDREW DOUGLAS
Georgia Institute of Technology, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt3398b
Internet: gt3398b@prism.gatech.edu