circularOrbit.frink

View or download 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"]


View or download 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 17591 days, 17 hours, 45 minutes ago.