TI84 Plus and HP Prime: Differential Equations and HalfIncrement
Solution, Numerical Methods
Introduction
The program HALFSTEP
solves the numerical differential equation
d^2y/dt^2 =
f(dy/dt, y, t) given the initial
conditions y(t0) = y0 and dy/dt (t0) = dy0
In this
notation, y is the independent variable and t is the dependent variable.
The Method
Let C =
f(dy/dt, y, t). Give the change of t as Δt.
First Step:
With t = t0:
h_1/2 = dy0 + C
* Δt/2
y1 = y0 + dy0 * Δt
Loop:
t = t0 + Δt
h_I+1/2
= h_I1/2 + C * Δt
y_I+1 = y_I +h_I+1/2 * Δt
Repeat as many
steps as desired.
This method was
presented by Robert M. Eisberg in his 1976 calculator programming book (see
source below).
Variables
The program
uses the following variables:
C: d^2y/dt^2.
Represent dy/dt as the variable A, y as the variable Y, and t as the
variable T.
The program
will always designate Y as the
independent variable and T as the dependent variable.
Examples:
Application

C

C
for HALFSTEP

FreeFall

d^2y/dt^2 = g

“9.80665”
(SI) or “32.1740468” (US)

FreeFall with
Friction

d^2y/dt^2 = g
 α (dy/dt)^2
(α = F/m)

“g  α * A^2”
(sub numeric
values for g, α)

Spring

d^2x/dt = k/m
* x

“k/m * T”
(sub numeric
values for k, m)

Pendulum

d^2θ/dt = α*sin(θ)
(α = g/l)

“α * sin(Y)”
(sub numeric
values for α)

Damped,
Driven Oscillations

d^2x/dt = α*x
– β*dx/dt + γ * sin(ω*t)

“α*Yβ*A+γ*sin(ω*T)”
(sub numeric
values for α, β, γ)

HP Prime Program HALFSTEP
Input: C. Use
single quotes to enclose d^2y/dt^2.
Represent dy/dt as A, y as Y, and t as T.
Output: A matrix of two columns, t and y.
EXPORT HALFSTEP(c,A,Y,D,tmax)
BEGIN
// d^2y/dt^2=C,dy0,y0,Δt,tmax
// EWS 20161117
// C use single quotes
// 'dy=A, y=Y, t=T'
// Radian mode
HAngle:=0;
LOCAL mat:=[[0,Y]],T,H;
LOCAL K:=3,I;
T:=D;
H:=A+EVAL(c)*D/2;
Y:=Y+H*D;
mat:=ADDROW(mat,[D,Y],2);
FOR I FROM 2*D TO tmax STEP D DO
T:=I; A:=H;
H:=H+EVAL(c)*D;
Y:=Y+H*D;
mat:=ADDROW(mat,[I,Y],K);
K:=K+1;
END;
RETURN mat;
END;
TI84 Plus Program
HALFSTEP
Input: For C, use enclose d^2y/dt^2 in quotes. Represent dy/dt as A, y as Y, and t as
T.
Output: A matrix of two columns, t and y.
"EWS
20161127"
Func
Radian
Disp
"D²Y/DT²=C"
Disp "USE
A=DY/DT,Y,T"
Input "C, USE A
STRING:",Y1
Input
"DY0:",A
Input
"Y0:",Y
Input "DELTA
TIME:",D
Input "TIME
MAX:",N
[[0][Y]]→[A]
D→T
A+Y1*D/2→H
Y+H*D→Y
augment([A],[[D][Y]])→[A]
For(I,2D,N,D)
I→T:H→A
H+Y1*D→H
Y+H*D→Y
augment([A],[[I][Y]])→[A]
End
[A]^T→[A]
Examples:
Please see the
screen shots below. Both are screen
shots from the TI84 Plus.
Source: Eiseberg, Robert M. Applied Mathematical Physics with
Programmable Pocket Calculators
McGrawHill, Inc: New York. 1976.
ISBN 0070191093
This blog is
property of Edward Shore, 2016.
Hi Eddie, I tried to use the Halfstep program on my TI84 Plus CE, unfortunately the error occurs here
ReplyDeleteaugment([A],[[D][Y]])→[A].
I copied your program to TIConnect CE software and send it to the calc with the sam program.
Are there some differences between TI84 Plus and TI84 Plus CE?
I have found on this blog a huge source of valuable information that helps me climb to a higher level every day.
ReplyDeleteดูบอลสด
ผลบอลเมื่อคืน
ผลบอลสด