# ParametricPlot3D and Sphere Graphics

I'm trying to put a sphere into a 3D parametric plot, but I seem to have a strange problem. Here's the code:


(Gravitational Constant)
G = 6.672*10^-11
(Mass of Earth and rocket)
M = AstronomicalData["Earth", "Mass"]
m = 2800000
(Rocket thrust)
T = 34020000
(Numerical solution modelling the gravitation interaction between Earth and a launching rocket)
(NOTE: Rocket mass will change over time; also, add in drag)
soln = NDSolve[{
x''[t] == -((G M x[t])/(x[t]^2 + y[t]^2 + z[t]^2)^(3/2)),
y''[t] == -((G M y[t])/(x[t]^2 + y[t]^2 + z[t]^2)^(3/2)) +
If[t > 1000, 0, 0.25 T/m],
z''[t] == -((G M z[t])/(x[t]^2 + y[t]^2 + z[t]^2)^(3/2)) +
If[t > 1000, 0, 0.75 T/m],
x == 0, y == 0, z == r, x' == 0, y' == 0,
z' == 0}, {x[t], y[t], z[t]}, {t, 0, 20000},
MaxSteps -> 1000000, Method -> "StiffnessSwitching"]

Show[ParametricPlot3D[
Evaluate[{x[t], y[t], z[t]} /. soln], {t, 0, 20000},
AxesLabel -> {x, y, z}, AspectRatio -> 1, BoxRatios -> 1,
PlotStyle -> Automatic, ImageSize -> Large],
Graphics3D[{Green, Sphere[{0, 0, 0}, r]}]]


And this is the output that I get, not a sphere but a curved plane: Does anyone know what I'm doing wrong?

• Everything is correct. It is part of sphere and with not so good parameters the orbit is inside the Earth :) – Kuba Aug 23 '13 at 21:58
• Please don't use <pre><code> and instead, indent by 4 spaces to format it as code. The former strips away the the asterisks in the comments and they now appear as invalid code. I edited this in your previous question. Please edit the above in the same manner. Thanks :) – rm -rf Aug 23 '13 at 22:31
• @rm-rf It's too localized or simple mistake I think. – Kuba Aug 23 '13 at 22:49

If you want to show everything use PlotRange->All in Show. Without this it will take options from first argument which is ParamatricPlot.

Motion equation you are using assumes that Earth mass is focused in its center so the result might look strange since the orbit is inside for not efficient initial conditions:

Show[
ParametricPlot3D[Evaluate[{x[t], y[t], z[t]} /. soln], {t, 0, 20000},
AxesLabel -> {x, y, z}, AspectRatio -> 1, BoxRatios -> 1,
PlotStyle -> Thick, ImageSize -> Large],
Graphics3D[{AbsolutePointSize@10, Red, Point[{0, 0, 0}], Green,
Opacity@.1, Sphere[{0, 0, 0}, r]}]
, PlotRange -> All, ImageSize -> 350] • Whoops hahaha, thanks again Kuba! – InquisitiveInquirer Aug 23 '13 at 22:23