# How to plot lines using consecutive points from an array using ParametricPlot3D or so?

I was trying to simulate Gravitational Orbits using Newtonian Gravitation. I did not use NDSolve[] but instead used finite differences; coded myself. The code for which is as follows:

M = 1; G = 1;h = 0.1; T = 1; n = T/h; (*steps*)

NewtonGrav[{vx_, vy_, vz_, x_, y_, z_}] :=
{vx + (-G M x)/Sqrt[x^2 + y^2 + z^2]*h,
vy + (-G M y)/Sqrt[x^2 + y^2 + z^2]*h,
vz + (-G M z)/Sqrt[x^2 + y^2 + z^2]*h,
x + vx*h, y + vy*h, z + vz*h}

DataNewton = NestList[NewtonGrav, {1, 1, 1, 1, 1, -1}, IntegerPart[n]];
DataPlot = Table[Drop[DataNewton[[i]], 3], {i, 1, Length[DataNewton]}]


The output of the above code is the array $\{{x[t],y[t],z[t]}\}$ for discreet $t$ values.

{{1, 1, -1}, {1.1, 1.1, -0.9}, {1.19423, 1.19423, -0.794226},
{1.28233, 1.28233, -0.683445}, {1.36404, 1.36404, -0.568408},
{1.43913, 1.43913, -0.449845}, {1.50744, 1.50744, -0.328455},
{1.56884, 1.56884, -0.204907}, {1.62326, 1.62326, -0.0798366},
{1.67063, 1.67063, 0.0461538}, {1.71094, 1.71094, 0.172492}}


I want to plot this data. But, I find no function that helps me do that properly. What I want is to plot all these points in 3-dimensional space and join all these with a line connecting the consecutive points in time. I am using a "brute force" method to demonstrate what I want.

Show[Graphics3D[Point[DataPlot[]]],
Graphics3D[Point[DataPlot[]]], Graphics3D[Point[DataPlot[]]],
Graphics3D[Point[DataPlot[]]], Graphics3D[Point[DataPlot[]]],
Graphics3D[Point[DataPlot[]]], Graphics3D[Point[DataPlot[]]],
Graphics3D[Point[DataPlot[]]], Graphics3D[Point[DataPlot[]]],
Graphics3D[Point[DataPlot[]]], Graphics3D[Point[DataPlot[]]]]


Whose output is as follows. These are all the calculated points of trajectory. Now, I want to join these points. Code for which would be.

Show[Graphics3D[Line[{DataPlot[], DataPlot[]}]] ,
Graphics3D[Line[{DataPlot[], DataPlot[]}]] ,
Graphics3D[Line[{DataPlot[], DataPlot[]}]] ,
Graphics3D[Line[{DataPlot[], DataPlot[]}]] ,
Graphics3D[Line[{DataPlot[], DataPlot[]}]] ,
Graphics3D[Line[{DataPlot[], DataPlot[]}]] ,
Graphics3D[Line[{DataPlot[], DataPlot[]}]] ,
Graphics3D[Line[{DataPlot[], DataPlot[]}]] ,
Graphics3D[Line[{DataPlot[], DataPlot[]}]],
Graphics3D[Line[{DataPlot[], DataPlot[]}]]] I want the final image as a direct output plot of the array I have in such a way that I can use manipulate to simulate the trajectory in time. Is there a function to do that? I have tried Plot3D[], ListPointPlot3D[], ParametricPlot3D[], ListPlot3D[].

The command ParametricPlot3D[] was the best choice among all but either it is not possible to use in the way I have written the code or I don't know how to do it. All other commands plotted out a surface plot (discrete or continuous). So, How to do it?

### ListPointPlot3D

ListPointPlot3D[DataPlot] To connect the points in a line:

ListPointPlot3D[DataPlot] /. Point -> Line To have both the points and the line:

ListPointPlot3D[DataPlot] /. p : Point[x_] :> {p, Line[x]} ### ParametricPlot3D + BSplineFunction

bsf = BSplineFunction[DataPlot];
ParametricPlot3D[bsf[t], {t, 0, 1}] • how to join these points to complete the trajectory? – シャシュワト Jul 18 '18 at 14:05
• how to remove the dots? – シャシュワト Jul 18 '18 at 14:07