Mathematica Asked on March 28, 2021
I got frustrated from trying to solve supposing simple physic’s problem. All book, textbooks, lectures are always calculation escape velocity from conservation of energy law. I am more ambitious more than that, I want to calculate r(t) and v(t) in one dimension if a stone is thrown up with high speed and observe myself, as a function of time, what is r(t) and r'(t) as a function in starting velocity on a massive planet.
The equation is simple but all trials failed
mr”=Gm*M/r^2 =→
I wrote a code but it gave me the distance embedded in an equation which it cannot solve (Mathematica12.1)
The trial:
Clear["Global`*"];
Delete All Output;
DSolve[r''[t]*(r[t])^2 + (G*M) == 0, r[t], t]
And this was the solution!
Solve[(-((2 G M ArcTanh[Sqrt[C[1] + (2 G M)/r[t]]/Sqrt[C[1]]])/C[1]^(
3/2)) + (Sqrt[C[1] + (2 G M)/r[t]] r[t])/C[1])^2 == (t + C[2])^2,
r[t]]
And Mathematica 12.1 can’t solve its solution
Also used NDSolve:
Clear["Global`*"];
Delete All Output;
Clear[k, R, v];
R = 6371 E 3;
k = 5.972 E 27;
v = 500;
NDSolve[{k + y[x]^2 (y^[Prime][Prime])[x] == 0, y[0] == R,
y'[0] == v}, y, {x, 0, 100}]
Plot[Evaluate[y[x] /. s], {x, 0, 100}, PlotRange -> All]
I got This comment:
{s} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing.
Any help to get r(t), and v(t) for one dimensional motion described by universal gravity law?
Note that you can divide your equation divide by m. Then you get: r'' == M G / r^2, independent of m.
For an example we choose an earthlike scenario. You may then change the code to your liking. If the planet is massive or not has only an effect on the escape velocity, the overall picture remains the same (as long as we deal with Newtonian physics), The only interesting case is, when the start velocity is around the escape velocity. Is it smaller, the body returns to earth, is it larger, then the body keeps on going. When the start velocity is equal to the escape velocity, it keeps on going but in this case the velocity tends to zero:
G = 6.674 10^-11;
r0 = 6.37 10^6;
mass = 6 10^24;
r0 = 6.371 10^6;
vesc = Sqrt[2 G mass/r0];
tmax = 10^5;
Manipulate[
eq = {r''[t] == -mass G/r[t]^2, r[0] == r0, r'[0] == v0};
res[t_] = r[t] /. NDSolve[eq, r, {t, 0, tmax}][[1]];
GraphicsGrid[{{Plot[res[t], {t, 0, tmax},
PlotLabel -> "Position"]}, {Plot[res'[t], {t, 0, tmax},
PlotLabel -> "Velocity"]}}]
, {v0, 0.97 vesc, 1.001 vesc}, TrackedSymbols :> {v0}]
Answered by Daniel Huber on March 28, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP