differential equations - Plotting the orbit of the Earth around the Sun. Error: step size is effectively zero; singularity or stiff system suspected
I've been asked to plot the orbit of the Earth around the sun over a period of three years. I've copied my exact code below. When I try to run it I get a series of errors, the first being:
NDSolve::ndsz: At
t == 9.641612453331499
*^-11`, step size is effectively zero; singularity or stiff system suspected.
I'm fairly new to Mathematica and I'm not sure why this error is appearing, or, when an error does appear, how to correct my code given what the error tells me.
G = 6.6723*10^(-11);
mSun = 1.989*10^30;
solEarth1 = NDSolve[{r''[t] == -G*mSun*r[t]/Norm[r[t]]^3, r[0] == {1, 0}, r'[0] == {0, 29785.1}}, r, {t, 0, 94608000}][[1]];
ParametricPlot[r[t] /. solEarth1, {t, 0, 94608000}, AxesLabel -> {"x (m)", "y (m)"}, PlotLabel -> "Orbit of Earth around the Sun"]
Comments
Post a Comment