Richard,
you did not specify your NBodySimulation
, so I cannot really see what your Evaluate[data["body1", "Position", t]][[1]]
here means. I suspect the syntax is not quite correct.
data["Position"]
gives an Association
containing the respective InterpolatingFunction
. Using a NBodySimulation
from the examples in the documentation I would do it like so:
data = NBodySimulation["InverseSquare", {
<|"Mass" -> 1, "Position" -> {0, 0}, "Velocity" -> {0, .5}|>,
<|"Mass" -> 1, "Position" -> {1, 1}, "Velocity" -> {0, -.5}|>,
<|"Mass" -> 1, "Position" -> {0, 1}, "Velocity" -> {0, 0}|>}, 4];
{xx, yy, zz} = Values@data["Position"];
{vxx, vyy, vzz} = Values@data["Velocity"];
{dvxx, dvyy, dvzz} = Derivative[1] /@ {vxx, vyy, vzz};
Does that help?