circularOrbit.frink

Download or view circularOrbit.frink in plain text format


// Solves period for a circular orbit.
use systemSolver2.frink

symbolicMode[true]
orbit= new System[[F === m a,
                   F === G m1 m2 / r^2,
                   a === omega^2 r,
                   freq === omega / (2 pi),
                   period === 1/freq,
                   mplanet === m1,
                   mplanet === m,
                   msun === m2],
                  ["G", "pi"]]

println[join["\n",orbit.solveFor["freq"]]]

// Plug in values for the earth's mass and its distance from the sun
args = [["msun", sunmass], ["r", earthdist]]
solutions = orbit.solveForValues["period", args]
println[eval[solutions]->"days"]


Download or view circularOrbit.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 20217 days, 23 hours, 57 minutes ago.