Orbital elements: Difference between revisions

Content added Content deleted
m (→‎version 2: aligned some statements, added whitespace.)
m (→‎version 2: fixed a typo, used a more idiomatic expression for numeric digits expression.)
Line 939: Line 939:
Translation of REXX version 1.
Translation of REXX version 1.
<lang rexx>/*REXX pgm converts orbital elements ──► orbital state vectors (angles are in radians).*/
<lang rexx>/*REXX pgm converts orbital elements ──► orbital state vectors (angles are in radians).*/
numeric digits length(pi() ) - 1 /*limited to pi len, but show 1/3 digs.*/
numeric digits length( pi() ) - length(.) /*limited to pi len, but show 1/3 digs.*/
parse value orbV(1, .1, 0, 355/(113*6), 0, 0) with position '~' speed
parse value orbV(1, .1, 0, 355/(113*6), 0, 0) with position '~' speed
say ' position:' show(position)
say ' position:' show(position)
Line 953: Line 953:
else L= 1 - eccentricity**2
else L= 1 - eccentricity**2
L= L * semiMaj /*calculate the semi─latus rectum.*/
L= L * semiMaj /*calculate the semi─latus rectum.*/
c= cos(anomaly); s= sin(anomaly) /*calculate COS and SIN of anomoly*/
c= cos(anomaly); s= sin(anomaly) /*calculate COS and SIN of anomaly*/
r= L / (1 + eccentricity * c)
r= L / (1 + eccentricity * c)
@= s*r**2 / L; speed= MA(i, @*c - r*s, j, @*s + r*c)
@= s*r**2 / L; speed= MA(i, @*c - r*s, j, @*s + r*c)