Distance from the Sun & Orbital Speed

+- HP Forums (http://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP Prime Software Library (/forum-15.html)
+--- Thread: Distance from the Sun & Orbital Speed (/thread-4244.html)



Distance from the Sun & Orbital Speed - Eddie W. Shore - 06-27-2015 11:00 AM

Link to the full blog entry: http://edspi31415.blogspot.com/2015/06/hp-prime-orbital-speed-and-velocity.html

The program ORBSD calculates approximately:

The distance of a planet (and dwarf planet Pluto) is from the sun and the speed of the planet, given at any given the number of Earth days (and partial Earth days) from the perihelion. A planet is at its perihelion is when the planet is closest to the Sun in its elliptical orbit. Earth is at its perihelion approximately January 3 to January 5 annually.

Equations

Angle used:

θ = 360° * d/N
d = number of days from perihelion
N = number of days in a planet’s “year”, or number of days it takes for a planet to make one orbit around the Sun

Distance from Sun (in meters):

r = (a*(1 - ϵ)/(1 + ϵ cos θ ))
a = length of semi-major axis of a planet’s orbit
ϵ = the eccentricity of an orbit (ellipse)

Orbital Speed (in meters/second):

v = √( G * (M_Sun + M_planet) * (2/r – 1/a))
G = Gravitational Constant = 6.63784 * 10^-11 m^3/(s^2 *kg)
M_Sun = Mass of the Sun ≈ 1.9884 * 10^30 kg
M_planet = Mass of the planet


Code:
EXPORT ORBSD()
BEGIN
// Orbital distance and
// speed around the Sun
// EWS 2015-06-25


// Initialization
LOCAL lm,pm,la,pa,le,pe;
LOCAL ld,pd;
LOCAL p,sp,θ,d,v,r;

// Planets
sp:={"Mercury","Venus","Earth",
"Mars","Jupiter","Saturn",
"Uranus","Neptune",
"Pluto (Dwarf)"};

// Mass (kg)
lm:={3.29438ᴇ23,4.85749ᴇ24,
5.9722ᴇ24,6.40397ᴇ23,1.89469ᴇ27,
5.67312ᴇ26,8.66437ᴇ25,1.02224ᴇ26,
1.31ᴇ22};

// Semi-Major Axis (m)
la:={57909829824,108209876544,
149594962176,227921734656,
778412012083,1.42673ᴇ12,
2.87097ᴇ12,4.49825ᴇ12,
5.90637ᴇ12};

// Eccentricity (ε)
le:={.206,.007,.017,.093,.048,
.056,.046,.009,.249};

// Days in a year
ld:={87.96899,224.701,365.256,
686.98,4332.58899,10759.22,
30685.4,60189,90465};

// Input
INPUT({{p,sp},d},"Data",
{"Planet:","# Days:"},
{"Planet","# Days after 
Perihelion"});

pm:=lm[p];
pa:=la[p];
pe:=le[p];
pd:=ld[p];
θ:=360*d/pd;
HAngle:=1; // degree

// distance
r:=(pa*(1-pe^2))/(1+pe*COS(θ));

// orbit distance
v:=√((1.9884ᴇ30+pm)*6.63784ᴇ−11*
(2/r-1/pa)); 

// output
PRINT();
PRINT("Distance from the Sun:");
PRINT(STRING(r)+" m");
PRINT("Orbital Speed:");
PRINT(STRING(v)+" m/s");

RETURN {r,v};

END;


Planetary Data (see sources below)

Mass (kg) Semi-Major Axis (m) Eccentricity Year (days)
Mercury 3.29438*10^23 57,909,829,824 .206 87.96899
Venus 4.85749*10^24 108,209,876,544 .007 224.701
Earth 5.9722*10^24 149,594,962,176 .017 365.256
Mars 6.40397*10^23 227,921,734,656 .093 686.98
Jupiter 1.89469*10^27 778,412,012,083 .048 4,332.58899
Saturn 5.67312*10^26 1.42673*10^12 .056 10,759.22
Uranus 8.66437*10^25 2.87097*10^12 .046 30,685.4
Neptune 1.02224*10^26 4.49825*10^12 .009 60,189
Pluto (dwarf planet) 1.31*10^22 5.90637*10^12 .249 90,465

** approximate values

Sources

Calvert, James B.  “Elllipse”   http://mysite.du.edu/~jcalvert/math/ellipse.htm  2002.  Retrieved June 20, 2015.

Glover, Thomas J.  “Pocket Ref” Sequoia Publishing, Inc.  Littleton, CO. 2012

“Orbital Speed” Wikipedia  https://en.wikipedia.org/wiki/Orbital_speed  Retrieved June 20, 2015

U.S. Navy “Astronomical Constants – The Astronomical Almanac Online” http://asa.usno.navy.mil/static/files/2015/Astronomical_Constants_2015.pdf   2015.