I'm new to Mathematica. Here is my original program: How to rewrite the Do part?
Clear["Global`*"];
da = {};
dt = 0.02;
endtime = 2;
Q = dQ = {0, 0, 0};
G = {0, -9.8, 0};
Do[
ddQ = G - Q;
dQ = dQ + ddQ*dt;
Q = Q + dQ*dt;
da = Append[da, dQ[[2]]]
, {t, 0, endtime, dt}
]
ListPlot[Flatten[da], DataRange -> {0, endtime}, PlotRange -> All]
Quit[];
Where Q denotes coordinates of a particle. ddQ denotes the acceleration which depends on the coordinates Q of the particle. In order to make the posted program readable and clean, I provided acceleration value in one element only.