Gravitational Potential
Dave Typinski, 2008

Gravitational Potential of the Solar System (The Physics Teacher, Sep 2008, p. 363)

(* Universal gravitational constant, (m^3)·(kg^(-1))·(s^(-2)) *)
G=6.67428×(10^(-11));

(* Astronomical Unit, m *)
AU=1.49598×(10^11);

(* Astronomical masses, kg *)
(Subscript[M, Sun])=1.9891×(10^30);
(Subscript[M, Mercury])=3.3020×(10^23);
(Subscript[M, Venus])=4.8685×(10^24);
(Subscript[M, Earth])=5.9736×(10^24);
(Subscript[M, Moon])=7.349×(10^22);
(Subscript[M, Mars])=6.4185×(10^23);
(Subscript[M, Jupiter])=1.8986×(10^27);
(Subscript[M, Saturn])=5.6846×(10^26);
(Subscript[M, Uranus])=8.6832×(10^25);
(Subscript[M, Neptune])=1.0243×(10^26);
M={(Subscript[M, Sun]),(Subscript[M, Mercury]),(Subscript[M, Venus]),(Subscript[M, Earth]),(Subscript[M, Moon]),(Subscript[M, Mars]),(Subscript[M, Jupiter]),(Subscript[M, Saturn]),(Subscript[M, Uranus]),(Subscript[M, Neptune])};

(* Astronomical body volumetric mean radii, m *)
(Subscript[r, Sun])=6.960×(10^8);
(Subscript[r, Mercury])=2.4397×(10^6);
(Subscript[r, Venus])=6.0518×(10^6);
(Subscript[r, Earth])=6.3710×(10^6);
(Subscript[r, Moon])=1.7371×(10^6);
(Subscript[r, Mars])=3.3895×(10^6);
(Subscript[r, Jupiter])=6.9911×(10^7);
(Subscript[r, Saturn])=5.8232×(10^7);
(Subscript[r, Uranus])=2.5362×(10^7);
(Subscript[r, Neptune])=2.4622×(10^7);
r={(Subscript[r, Sun]),(Subscript[r, Mercury]),(Subscript[r, Venus]),(Subscript[r, Earth]),(Subscript[r, Moon]),(Subscript[r, Mars]),(Subscript[r, Jupiter]),(Subscript[r, Saturn]),(Subscript[r, Uranus]),(Subscript[r, Neptune])};

(* Astronomical body orbit semi-major axis, m *)
(Subscript[R, Sun])=0;
(Subscript[R, Mercury])=5.791×(10^10);
(Subscript[R, Venus])=1.0821×(10^11);
(Subscript[R, Earth])=AU;
(Subscript[R, Moon])=AU+3.844×(10^8);
(Subscript[R, Mars])=2.2792×(10^11);
(Subscript[R, Jupiter])=7.7857×(10^11);
(Subscript[R, Saturn])=1.4335×(10^12);
(Subscript[R, Uranus])=2.8725×(10^12);
(Subscript[R, Neptune])=4.4951×(10^12);
R={(Subscript[R, Sun]),(Subscript[R, Mercury]),(Subscript[R, Venus]),(Subscript[R, Earth]),(Subscript[R, Moon]),(Subscript[R, Mars]),(Subscript[R, Jupiter]),(Subscript[R, Saturn]),(Subscript[R, Uranus]),(Subscript[R, Neptune])};

(* Number of bodies *)
B=10;

(* Gravitational potential in J·(kg^(-1)) *)
(* M = body mass, kg *)
(* r = body radius, m *)
(* R = body orbit semi-major axis, m *)
(* x = distance from center of Sun *)
(Subscript[V, g])[M_,r_,R_,x_]:=-((G M)/r)/;Abs[R-x]≤r;
(Subscript[V, g])[M_,r_,R_,x_]:=-((G M)/(Abs[R-x]))/;r<Abs[R-x];

(* Net potential within solar system; i.e., sum of individual potentials *)
(Subscript[V, net])[x_]:=((∑_(i=1)^B)(Subscript[V, g])[M[[i]],r[[i]],R[[i]],x])×(10^(-9));

(Subscript[V, net])[AU-3.844×(10^8)]
(Subscript[V, net])[AU+3.844×(10^8)]
(Subscript[V, net])[AU-3.844×(10^8)]-(Subscript[V, net])[AU+3.844×(10^8)]


(* Solar System *)
Plot[{(Subscript[V, net])[x AU]},{x,-7,31},PlotRange->{5,-200},PlotPoints->10000,PlotStyle->{{RGBColor[0,0,.7],Thin}},Axes->None,GridLines->None,Frame->True,RotateLabel-> True,FrameStyle->{{Directive[Thin,FontFamily->Helvetica,14],Thin},{Directive[Thin,FontFamily->Helvetica,14],Thin}},FrameLabel->{Style["Distance from Sun, AU",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential, GJ·(kg^(-1))",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential as a Function of Distance From the Sun - Solar System",Bold,FontSize->16,FontFamily->Helvetica],""}]

(* Solar System *)
Plot[{(Subscript[V, net])[x AU]},{x,-7,31},PlotRange->{0,-2.1},PlotPoints->10000,PlotStyle->{{RGBColor[0,0,.7],Thin}},Axes->None,GridLines->None,Frame->True,RotateLabel-> True,FrameStyle->{{Directive[Thin,FontFamily->Helvetica,14],Thin},{Directive[Thin,FontFamily->Helvetica,14],Thin}},FrameLabel->{Style["Distance from Sun, AU",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential, GJ·(kg^(-1))",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential as a Function of Distance From the Sun - Solar System",Bold,FontSize->16,FontFamily->Helvetica],""}]

(* Terrestrial planets & Jupiter *)
Plot[{(Subscript[V, net])[x AU]},{x,-.6,5.5},PlotRange->{0,-2.4},PlotPoints->20000,PlotStyle->{{RGBColor[0,0,.7],Thin}},Axes->None,GridLines->None,Frame->True,RotateLabel-> True,FrameStyle->{{Directive[Thin,FontFamily->Helvetica,14],Thin},{Directive[Thin,FontFamily->Helvetica,14],Thin}},FrameLabel->{Style["Distance from Sun, AU",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential, GJ·(kg^(-1))",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential as a Function of Distance From the Sun - Terrestrial Planets & Jupiter",Bold,FontSize->16,FontFamily->Helvetica],""}]

(* Gas giants *)
Plot[{(Subscript[V, net])[x AU]},{x,4,31},PlotRange->{0,-2.1},PlotPoints->10000,PlotStyle->{{RGBColor[0,0,.7],Thin}},Axes->None,GridLines->None,Frame->True,RotateLabel-> True,FrameStyle->{{Directive[Thin,FontFamily->Helvetica,14],Thin},{Directive[Thin,FontFamily->Helvetica,14],Thin}},FrameLabel->{Style["Distance from Sun, AU",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential, GJ·(kg^(-1))",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential as a Function of Distance From the Sun - Gas Giants",Bold,FontSize->16,FontFamily->Helvetica],""}]

(* Terrestrial planets *)
Plot[{(Subscript[V, net])[x AU]},{x,.2,1.7},PlotRange->{-.4,-2.7},PlotPoints->10000,PlotStyle->{{RGBColor[0,0,.7],Thin}},Axes->None,GridLines->None,Frame->True,RotateLabel-> True,FrameStyle->{{Directive[Thin,FontFamily->Helvetica,14],Thin},{Directive[Thin,FontFamily->Helvetica,14],Thin}},FrameLabel->{Style["Distance from Sun, AU",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential, GJ·(kg^(-1))",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential as a Function of Distance From the Sun - Terrestrial Planets",Bold,FontSize->16,FontFamily->Helvetica],""}]

(* Mercury *)
Plot[{(Subscript[V, net])[x AU]},{x,.361,.413},PlotRange->{-2.26,-2.34},PlotPoints->1000,PlotStyle->{{RGBColor[0,0,.7],Thin}},Axes->None,GridLines->None,Frame->True,RotateLabel-> True,FrameStyle->{{Directive[Thin,FontFamily->Helvetica,14],Thin},{Directive[Thin,FontFamily->Helvetica,14],Thin}},FrameLabel->{Style["Distance from Sun, AU",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential, GJ·(kg^(-1))",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential as a Function of Distance From the Sun - Mercury Vicinity",Bold,FontSize->16,FontFamily->Helvetica],""}]

(* Venus *)
Plot[{(Subscript[V, net])[x AU]},{x,.697,.749},PlotRange->{-1.215,-1.295},PlotPoints->1000,PlotStyle->{{RGBColor[0,0,.7],Thin}},Axes->None,GridLines->None,Frame->True,RotateLabel-> True,FrameStyle->{{Directive[Thin,FontFamily->Helvetica,14],Thin},{Directive[Thin,FontFamily->Helvetica,14],Thin}},FrameLabel->{Style["Distance from Sun, AU",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential, GJ·(kg^(-1))",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential as a Function of Distance From the Sun - Venus Vicinity",Bold,FontSize->16,FontFamily->Helvetica],""}]

(* Earth *)
Plot[{(Subscript[V, net])[x AU] 1000},{x,.97,1.022},PlotRange->{-876,-955},PlotPoints->1000,PlotStyle->{{RGBColor[0,0,.7],Thin}},Axes->None,GridLines->None,Frame->True,RotateLabel-> True,FrameStyle->{{Directive[Thin,FontFamily->Helvetica,14],Thin},{Directive[Thin,FontFamily->Helvetica,14],Thin}},FrameLabel->{Style["Distance from Sun, AU",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential, MJ·(kg^(-1))",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential as a Function of Distance From the Sun - Earth Vicinity",Bold,FontSize->16,FontFamily->Helvetica],""}]

(* Mars *)
Plot[{(Subscript[V, net])[x AU] 1000},{x,1.498,1.55},PlotRange->{-551,-630},PlotPoints->1000,PlotStyle->{{RGBColor[0,0,.7],Thin}},Axes->None,GridLines->None,Frame->True,RotateLabel-> True,FrameStyle->{{Directive[Thin,FontFamily->Helvetica,14],Thin},{Directive[Thin,FontFamily->Helvetica,14],Thin}},FrameLabel->{Style["Distance from Sun, AU",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential, MJ·(kg^(-1))",FontSize->14,FontFamily->Helvetica],Style["Gravitational Potential as a Function of Distance From the Sun - Mars Vicinity",Bold,FontSize->16,FontFamily->Helvetica],""}]