Python Code that finds $U_m$ given :
$M_s-mass,\\R_s-radius,\\ B_s^{eq}-field,\\ M_p-mass,\\ R_p-radius, \\B_p^{eq}-field,\\ e-eccentricity,\\ unit-M_p, R_p\text{ is measured with respect to Earth(”e”) or Jupiter(”j”) or Sun(”s”)}$
Syntax -
$energy(M_s, R_s, B_s, M_p, R_p, B_p, e, unit)$
Default Units of M_p and R_p are with respect to earth
To run the code
- Click on Run Pen
- Code can be compiled and run from this website
- Add the function in the above-mentioned syntax at the end of the 1st box in the embedded window below, then click on the “RUN” button in green
Sample Inputs
Code for the energy function
https://codepen.io/vasanthkashyap/pen/OJOObjy?editors=1000
Dependence of Energy with respect to Time
https://www.desmos.com/calculator/pdvkmt2vqa