# Calculating with scientific notation

I want to calculate the gravitational force between the Earth and its Moon using Newton's gravitational formula: (G M1 M2)/d^2 and its appropriate physical units. I'd include the code I wrote for this question, but I don't know how to display it. Thank you for help.

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Michael E2 Oct 1 '17 at 23:48
• You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is useful for learning how to format your questions and answers. You may also find this meta Q&A helpful – Michael E2 Oct 1 '17 at 23:49

FormulaLookup["force of gravity"]

(* {"NewtonsLawOfUniversalGravitation"} *) g = Quantity[1, "GravitationalConstant"];
m1 = Quantity[1, "EarthMass"];
m2 = PlanetaryMoonData["Moon", "Mass"];
r = PlanetaryMoonData["Moon", "DistanceFromEarth"];

{g, m1, m2, r} {g, m1, m2, r} // UnitConvert

(* {Quantity[6.674*10^-11, ("Meters")^3/("Kilograms" ("Seconds")^2)],
Quantity[5.9721986*10^24, "Kilograms"],
Quantity[7.3459*10^22, "Kilograms"], Quantity[3.90946*10^8, "Meters"]} *)

f = g*m1*m2/r^2 // UnitConvert

(* Quantity[1.91575*10^20, ("Kilograms" "Meters")/("Seconds")^2] *)


EDIT: Note that PlanetaryMoonData["Moon", "DistanceFromEarth"] is not a constant but is dynamically updated to reflect the varying value due to the Moon's orbit not being circular.

PlanetaryMoonData["Moon", "DistanceFromEarth"] // UnitConvert

(* Quantity[3.88389*10^8, "Meters"] *)


Depending on your needs, you can use the average value

PlanetaryMoonData["Moon", "AverageDistanceFromEarth"] // UnitConvert

(* Quantity[3.850*10^8, "Meters"] *)

• Could also be done directly with: FormulaData["NewtonsLawOfUniversalGravitation", { "r" -> PlanetaryMoonData["Moon", "DistanceFromEarth"], Subscript["m", 1] -> Quantity[1, "EarthMass"], Subscript["m", 2] -> PlanetaryMoonData["Moon", "Mass"] } ] – chuy Oct 2 '17 at 14:32