Even though I know this won't advance the space program, I thought I would share this little routine I have put together that really seems to make excellent use of the 42S/Free42:

00 { 152-Byte Prgm }

01>LBL "KEPORB"

02 MVAR "PER"

03 MVAR "ECC"

04 MVAR "PH"

05 MVAR "T"

06 VARMENU "KEPORB"

07 RAD

08 STOP

09 EXITALL

10 PI

11 RCL× "T"

12 RCL÷ "PER"

13 STO+ ST X

14 STO "MA"

15 PGMSLV "KEPEQ"

16 STO "EA"

17 SOLVE "EA"

18 0.5

19 RCL× "EA"

20 TAN

21 1

22 RCL+ "ECC"

23 1

24 RCL- "ECC"

25 ÷

26 SQRT

27 ×

28 ATAN

29 STO+ ST X

30 ENTER

31 ->DEG

32 X<>Y

33 COS

34 RCL× "ECC"

35 1

36 +

37 1

38 RCL+ "ECC"

39 X<>Y

40 ÷

41 RCL× "PH"

42 RTN

43>LBL "KEPEQ"

44 RCL "MA"

45 RCL- "EA"

46 RCL "EA"

47 SIN

48 RCL× "ECC"

49 +

50 .END.

The routine returns the heliocentric polar coordinates of a planet's orbit given the orbital PERiod, ECCentricity, and PeriHelion (i.e, nearest to the Sun) distance at a given time T (with the understanding the T=0 is at perihelion). The program returns the distance from the sun in the X register and the angle of rotation in degrees (with the understand that the angle is zero at perihelion) in the Y register.

To use XEQ KEPORB, enter the orbital parameters for your planet (easily found all over the place--I use Wikipedia) into the menu variables PER, ECC, and PH, enter the desired T into that menu variable, hit R/S, and the result is returned as described.

Units obviously must be consistent. If the PERiod entered is in days, the T entered should also be in days. The distance returned will be in the same units as that of PeriHelion distance provided.

I like the internal programmed use of the Solver to numerically solve the transcendental Kepler equation. Those who know about this stuff will see that I use the known Mean Anomaly as a reasonable initial guess to the desired Eccentric Anomaly. In our solar system this is a pretty good approximation since the elliptical orbits are actually almost circular in most cases, and even in the exceptions like Pluto and Mercury things are still pretty close.

Info on the math is [link:http://en.wikipedia.org/wiki/Kepler's_laws_of_planetary_motion]here[/link].

The RAW file, for Free42 users, is here.

Hope someone else also finds this amusing.

Les

*Edited: 13 Aug 2009, 10:01 p.m. after one or more responses were posted*