Sunday, August 13, 2017

HP 32SII: Tracing the Orbit Coordinates

HP 32SII:  Tracing the Orbit Coordinates

The following program tracks the position (x,y) of a satellite in orbit by solving the pair of second-order differential equations:

d^2 x/dt^2 = -α * x * (x^2 + y^2)^-1.5

d^2 y/dt^2 = -α * y * (x^2 + y^2)^-1.5

For planetary orbits, α = G * M

Variables and Labels

Labels Used:  4 (A, B, C, D)

Variables Used:
Pre stored variables:
X = x0, initial x position
U = dx/dt, velocity of x coordinate
Y = y0, initial y position
V = dy/dt, velocity of y coordinate
C = Δt, desired time increment
A = α, gravitational force factor

If you are analyzing planetary orbits, then α = G * M where M is the mass of the center object and G is the Universal gravitational constant, G = 6.67384 * 10^-11 (m^3)/(s^2 * kg). 

Other:
T = t

This program is based off of the HP 25S and program authored Robert M. Eisberg. (see the source below)

HP 32SII Program (87.5 bytes)

A01 LBL A   // start of program
A02 0
A03 STO T   // initialize time variable
C01 LBL C
C02 RCL Y
C03 RCL Y
C04 x^2
C05 RCL X
C06 x^2
C07 +
C08 -1.5
C09 y^x
C10 RCL A
C11 *
C12 *       // calculate –α*y*(x^2 + y^2)^-1.5
C13 LASTx 
C14 RCL X
C15 *      // calculate –α*x*(x^2 + y^2)^-1.5
C16 RCL T
C17 x=0?
C18 GTO B
C19 R↓
D01 LBL D
D02 RCL C
D03 *
D04 STO- U
D05 R↓
D06 RCL C
D07 *
D08 STO- V
D09 RCL C
D10 STO+ T
D11 RCL U
D12 *
D13 STO+ X
D14 RCL X
D15 STOP       // view X
D16 RCL C
D17 RCL V
D18 *
D19 STO+ Y
D20 RCL Y
D21 STOP       // view Y
D22 GTO C      // start a new loop
B01 LBL B
B02 R↓
B03 2
B04 ÷
B05 x<>y
B06 2
B07 ÷
B08 x<>y
B09 GTO D

During execution, recall T for the time variable.  Run by XEQ A.

Example

Pre stored variables:
X = 1.5
U = 0.18
Y = 1.5
V = 0.23
C = 1
A = α = 1

Table:
T =
X =
Y =
0   (initial)
1.5
1.5
1
1.6014
1.6514
2
1.5713
1.6672
3
1.4105
1.5443
4
1.0956
1.2527
5
0.5429
0.6892
6
-0.8138
-0.8949

Source:  Robert M. Eiseberg.  Applied Mathematical Physics with Programmable Calculators McGraw Hill.  1976.  ISBN 0-07-019109-3

Eddie


This blog is property of Edward Shore, 2017.