Programs Ti89
Programs Ti89
Programs
Dr. D.G. Simpson
Department of Physical Sciences and Engineering
Prince George’s Community College
May 3, 2014
These calculator programs are written for the Texas Instruments Voyage 200 graph-
ing calculator and similar models with the Motorola 68000 processor (TI-89 and TI-
92), using the built-in TI-BASIC language. Refer to the “Programming” chapter of the
Voyage 200 Graphing Calculator manual for instructions on entering and running a
program in the calculator.
Contents
1. Projectile Problem
2. Kepler’s Equation
3. Hyperbolic Kepler’s Equation
4. Barker’s Equation
5. Reduction of an Angle
6. Helmert’s Equation
7. Pendulum Period
8. 1D Perfectly Elastic Collisions
1
1 Projectile Problem
This program solves the projectile problem: given a target sitting on a hill at coordi-
nates .x t ; y t / and a cannon with muzzle velocity v0 , at what angle should the cannon
be aimed to hit the target? The solution is found numerically using Newton’s method.
To run the program, execute program projtl(). At the prompt v=? enter the
muzzle velocity ENTER. At the prompt x=? enter the horizontal coordinate of the
target x t followed by ENTER. At the prompt y=? enter the vertical coordinate of the
target y t followed by ENTER. At the prompt =? enter the initial estimate of the launch
angle 0 followed by ENTER. The program returns the launch angle in degrees.
After running the program, the calculator will be set to degrees mode.
Program Listing
:projtl()
:Prgm
:setMode("Angle","Radian")
:Prompt v,x,y,
: * /180!
:For j,1,15
: -(x*sin(2*)-2*y*(cos())ˆ2-9.8*(x/v)ˆ2)/(2*x*cos(2*)+2*y*sin(2*))!
:EndFor
: *180/ !
:Disp "=",
:setMode("Angle","Degree")
:EndPrgm
2
2 Kepler’s Equation
Given the mean anomaly M (in degrees) and the orbit eccentricity e, this program
solves Kepler’s equation
M D E e sin E
Program Listing
:kepler()
:Prgm
:setMode("Angle","Radian")
:Prompt m,e
:m*/180!m
:m!a
:For j,1,15
: a-(m-a+e*sin(a))/(e*cos(a)-1)!a
:EndFor
:a*180/ !a
:Disp "EA=",a
:setMode("Angle","Degree")
:EndPrgm
Example. Let M D 60ı , e D 0:15. Enter the above program, and execute program
kepler(). At the prompt M=? enter 60 ENTER; at the prompt E=? enter .15
ENTER. The program returns E D 67:9667ı.
3
3 Hyperbolic Kepler’s Equation
Given the mean anomaly M (in degrees) and the orbit eccentricity e, this program
solves the hyperbolic Kepler equation
M D e sinh F F
Program Listing
:hkepler()
:Prgm
:Prompt m,e
:m*/180!m
:m!a
:For j,1,15
: a-(m-e*sinh(a)+a)/(1-e*cosh(a))!a
:EndFor
:Disp "F=",a
:EndPrgm
Example. Let M D 60ı , e D 1:15. Enter the above program, and execute program
kepler(). At the prompt M=? enter 60 ENTER; at the prompt E=? enter 1.15
ENTER. The program returns F D 1:55552.
4
4 Barker’s Equation
p
GM=.2q 3 /.t Tp /, this program solves Barker’s equation
Given the constant K D
s
f 1 3 f GM
tan C tan D .t Tp /
2 3 2 2q 3
Program Listing
:barker()
:Prgm
:Prompt k
:1.5*abs(k)!a
p
: (1+a*a)+a!b
:bˆ(1/3)!c
:(c*c-1)/(2*c)!d
:2*d!e
:If k<0 Then
: e!e
:EndIf
:2*tan1 (e)!f
:Disp "F=",f
:EndPrgm
Example. Let K D 19:38, and put the calculator in Degrees mode. Enter the above
program, and execute program barker(). At the prompt k=? enter 19.38 ENTER.
The program returns f D 149:085ı.
5
5 Reduction of an Angle
This program reduces a given angle to the range Œ 0; 360ı/ in degrees mode, or Œ 0; 2 /
in radians mode. It will work correctly whether the calculator is set for degrees or
radians mode.
To run the program, execute program reduce(). At the prompt =? enter the
angle (in either degrees or radians) followed by ENTER. The program will return the
equivalent reduced angle.
Program Listing
:reduce()
:Prgm
:Prompt
:2*cos1 (-1)!t
:If < 0 Then
: iPart(/t)+1!v
: +v*t!r
:ElseIf t Then
: iPart(/t)!v
: -v*t!r
:Else
: !r
:EndIf
:Disp "=",r
:EndPrgm
Example. Let D 5000ı, and set the calculator for Degrees mode. Enter the above
program, press PRGM and execute program REDUCE. At the prompt =? enter 5000
ENTER. The program returns D 320ı.
6
6 Helmert’s Equation
Given the latitude (in degrees) and the elevation H , this program uses Helmert’s
equation to find the acceleration due to gravity g.
To run the program, execute program helmert(). At the prompt =? enter the
latitude in degrees followed by ENTER. At the prompt h=? enter the elevation H
followed by ENTER. The program returns the acceleration due to gravity g in m/s2 .
After running the program, the calculator will be set to degrees mode.
Program Listing
:helmert()
:Prgm
:setMode("Angle","Degree")
:Prompt ,h
:9.80616-.025928*cos(2*)+6.9E-5*(cos(2*))ˆ2-3.086E-6*h!g
:Disp "g=",g
:EndPrgm
7
7 Pendulum Period
Given the length L and amplitude of a simple plane pendulum, this program finds
the period T , using the arithmetic-geometric mean method.
To run the program, execute program pend(). At the prompt l=? enter the pen-
dulum length L in meters followed by ENTER. At the prompt =? enter the pendulum
amplitude in degrees followed by ENTER. The program returns the period T in sec-
onds.
After running the program, the calculator will be set to degrees mode.
Program Listing
:pend()
:Prgm
:setMode("Angle","Degree")
:Prompt l,
:.5*(1+cos(.5*))!a
p
: (cos(.5*))!g
:For n,1,10
: .5*(a+g)!b
p
: (a*g)!g
: b!a
:EndFor
p
:2* * (l/9.8)/a!t
:Disp "T=",t
:EndPrgm
Example. Let L D 1:2 m and D 65ı. Enter the above program and execute
program pend(). At the prompt l=? enter 1.2 ENTER. At the prompt = enter 65
ENTER. The program returns T D 2:38977 sec.
8
8 1D Perfectly Elastic Collisions
Given the masses m1 and m2 of two bodies and their initial velocities v1i and v2i , this
program finds the post-collision velocities v1f and v2f , using
m1 m2 2m2
v1f D v1i C v2i
m1 C m2 m1 C m2
2m1 m2 m1
v2f D v1i C v2i
m1 C m2 m1 C m2
To run the program, execute program ELAS1D. At the prompts, enter the masses
m1 (as m) and m2 (as n), and the initial velocities v1i (as v) and v2i (as w), in consistent
units. The program will return the post-collision velocities v1f and v2f in the same
units.
Program Listing
:elas1d()
:Prgm
:Prompt m,n,v,w
:(m-n)/(m+n)*v+2*n*w/(m+n)!x
:2*m*v/(m+n)+(n-m)/(m+n)*w!y
:Disp "v1f=",x
:Disp "v2f=",y
:EndPrgm
Example. Enter the above program and execute program elas1d. At the prompts,
enter: m1 D m D 2:0 kg; m2 D n D 7:0 kg; v1i D v D 4:0 m/s; and v2i D w
D 5:0 m/s. The program returns v1f D 10 m/s and v2f D 1 m/s.