[Solved]Lab Simulating Moon S Orbit Around Earth Exercise 1 Use Better Numerical Method Example Si Q37032874
EXERCISE 1 ONLY PLEASE.


![# This example illustrates a (terrible) numerical integration using Eulers method Euler-orbit = [] pv- vector(list(Ecmpos)+l](https://media.cheggcdn.com/media%2F6e5%2F6e54bfe7-3093-4a76-881c-4878f10baf1d%2FphpkEYLC8.png)
This lab is about simulating the Moon’s orbit around the Earth. Exercise 1: Use a better numerical method than in the example to simulate the Earth-Moon-Sun system for 1 year. Find when the smallest angle between the Earth-Moon difference vector and the Earth-Sun distance vector occurs. Your answer should be consistent with either of the predicted eclipses (on uly 2 and December 26th, 2019). Exercise 2 (optional+5 points): Add in the gravitational effect of Jupiter. Does it make any difference to the eclipse timing? # Relevant constants G 6.67488*10^(-11) # Hm : 7.349″18″(22) Me 5.97219″10″(24) # Ms 1.9885*10″(30) 垳 1898 .13 10″(24) # Aukm 149597870.691 Aum149597870691.0 Gad-6*(24*60*60)^2/Aum^3 gravitational constant in SI units m^3/kg/s^2 # Moon mass in kg Earth mass in kg # Sun mass in kg Jupiter mass in kg # Astronomical unit in kilometers # Astronomical unit in meters # gravitational constant in Aung/kg/days”2 Time t- is Julian 2458579.58908800 2819-Mar-28 00:00:80.0880 TOB # in our time zone t:0 is at 6 pm, March 27th, 2019 Ecmpos(-0.998959496966424, -0.117531327986682, 7.2379908177611e-6) Ecmve1 = (0.00173968703982670, -0.0171495149148187, 1.34033597137412e-6) # Earth velocity in Au/day Mcmpos (-9.9987 37896 718982,-9. 12017892236 7455, 0.0000826507428059662) 并Moon position Mcmvel . (0.89230734437385251, -0.0171 337922113680, -0.0000454155866197130) # Moon velocity Scmpos (3.01282762193502e-6, 3.57430617194733e-7, -2.47928863955332e-11) #Sun position 5cmvel = (-5.31018771959621e-9, 5.213946 38515184e-8, -2.34787046728595e-12) # Sun velocity 2cmpos (-1.53257173143778, -5.09807139483730, θ.0554662662104724) 3cmve1 = (0.89714293701096632, -0.88181843 173356035, -0.000152259659393642) # Jupiter velocity Earth position in Au # Jupiter position def FG(p1,p2,m1,m2): # Newtonian gravitational force between two bodies # p1,p2 positions (AU), m1,m2 are masses (kg), time is in days return (p2-p1)*Gad*m1*m2/norm(p2-p1)A3 def Acc(pos): # accelerations in the earth-moon-sun system, in AU/day^2 # Earth-Moon-Sun center of mass is origin Pe vector (RDF, pos [0:3]) Pmvector (RDF, pos [3:6]) Ps vector (RDF, pos [6:9]) FGseFG (Ps,Pe,Ms,Me) FGsmFG (Ps, Pm,Ms,Mm) Acce -FGem/Me FGse/Me Accm- -FGsm/Mm FGem/Mm AccsFGsm/Ms FGse/Ms return vector (RDF, list(Acce)+list (Accm)+list (Accs)) def f(pos vel): # “Slope” function for E-M-S system as a set of first-order ODEs acAcc(pos_vel) return vector (RDF, list(pos_vel[9:18]) list(ac)) # This example illustrates a (terrible) numerical integration using Euler’s method Euler-orbit = [] pv- vector(list(Ecmpos)+list (Mcmpos)+list (Scmpos)+list(Ecmvel)+list (Mcmvel)+list(Scmvel)) # stepsize of 1 day is too large for this method In steps = 365 for i in range(n steps): Euler_orbit.append(pv) k1 = f(pv) # Show the orbits in the X-Y plane eplot = list-plot (Euler-orbit [i][02] for i in range(n-steps), mplot = list-plot (Euler-orbit [i] [3:5] for i in range(n-steps), splot = list-plot (Euler-orbit [i][63] for i in range(n-steps), show (eplot+mplot+splot, figsize 4, aspect_ratio-1) rgbcolor=”green’) rgbcolor=”gray’) rgbcolor=’yellow’) plotjoined-True, plot joined-True, plot joined-True, 0.5 0.5 0.5 0.5 Show transcribed image text This lab is about simulating the Moon’s orbit around the Earth. Exercise 1: Use a better numerical method than in the example to simulate the Earth-Moon-Sun system for 1 year. Find when the smallest angle between the Earth-Moon difference vector and the Earth-Sun distance vector occurs. Your answer should be consistent with either of the predicted eclipses (on uly 2 and December 26th, 2019). Exercise 2 (optional+5 points): Add in the gravitational effect of Jupiter. Does it make any difference to the eclipse timing? # Relevant constants G 6.67488*10^(-11) # Hm : 7.349″18″(22) Me 5.97219″10″(24) # Ms 1.9885*10″(30) 垳 1898 .13 10″(24) # Aukm 149597870.691 Aum149597870691.0 Gad-6*(24*60*60)^2/Aum^3 gravitational constant in SI units m^3/kg/s^2 # Moon mass in kg Earth mass in kg # Sun mass in kg Jupiter mass in kg # Astronomical unit in kilometers # Astronomical unit in meters # gravitational constant in Aung/kg/days”2 Time t- is Julian 2458579.58908800 2819-Mar-28 00:00:80.0880 TOB # in our time zone t:0 is at 6 pm, March 27th, 2019 Ecmpos(-0.998959496966424, -0.117531327986682, 7.2379908177611e-6) Ecmve1 = (0.00173968703982670, -0.0171495149148187, 1.34033597137412e-6) # Earth velocity in Au/day Mcmpos (-9.9987 37896 718982,-9. 12017892236 7455, 0.0000826507428059662) 并Moon position Mcmvel . (0.89230734437385251, -0.0171 337922113680, -0.0000454155866197130) # Moon velocity Scmpos (3.01282762193502e-6, 3.57430617194733e-7, -2.47928863955332e-11) #Sun position 5cmvel = (-5.31018771959621e-9, 5.213946 38515184e-8, -2.34787046728595e-12) # Sun velocity 2cmpos (-1.53257173143778, -5.09807139483730, θ.0554662662104724) 3cmve1 = (0.89714293701096632, -0.88181843 173356035, -0.000152259659393642) # Jupiter velocity Earth position in Au # Jupiter position
def FG(p1,p2,m1,m2): # Newtonian gravitational force between two bodies # p1,p2 positions (AU), m1,m2 are masses (kg), time is in days return (p2-p1)*Gad*m1*m2/norm(p2-p1)A3 def Acc(pos): # accelerations in the earth-moon-sun system, in AU/day^2 # Earth-Moon-Sun center of mass is origin Pe vector (RDF, pos [0:3]) Pmvector (RDF, pos [3:6]) Ps vector (RDF, pos [6:9]) FGseFG (Ps,Pe,Ms,Me) FGsmFG (Ps, Pm,Ms,Mm) Acce -FGem/Me FGse/Me Accm- -FGsm/Mm FGem/Mm AccsFGsm/Ms FGse/Ms return vector (RDF, list(Acce)+list (Accm)+list (Accs)) def f(pos vel): # “Slope” function for E-M-S system as a set of first-order ODEs acAcc(pos_vel) return vector (RDF, list(pos_vel[9:18]) list(ac))
# This example illustrates a (terrible) numerical integration using Euler’s method Euler-orbit = [] pv- vector(list(Ecmpos)+list (Mcmpos)+list (Scmpos)+list(Ecmvel)+list (Mcmvel)+list(Scmvel)) # stepsize of 1 day is too large for this method In steps = 365 for i in range(n steps): Euler_orbit.append(pv) k1 = f(pv) # Show the orbits in the X-Y plane eplot = list-plot (Euler-orbit [i][02] for i in range(n-steps), mplot = list-plot (Euler-orbit [i] [3:5] for i in range(n-steps), splot = list-plot (Euler-orbit [i][63] for i in range(n-steps), show (eplot+mplot+splot, figsize 4, aspect_ratio-1) rgbcolor=”green’) rgbcolor=”gray’) rgbcolor=’yellow’) plotjoined-True, plot joined-True, plot joined-True, 0.5 0.5 0.5 0.5
Expert Answer
Answer to This lab is about simulating the Moon’s orbit around the Earth. Exercise 1: Use a better numerical method than in the ex… . . .
OR

