Im attempting to use the NDSolve
funtction to solve a coupled system of 2nd order differential equations. The differential equations are the for the acceleration of a body due to the gravitational forces of other bodies
Where
and
variables
μ =
{0.00029591220828349645438389263285760599`10.122911634152604,
8.8876924487802410900708441245`8.697447781980085*^-10,
1.0931894685338682`*^-11};
rx = {0, 0.9832672274945706, 0.9847793657772581}
v = {0, 0.017491119160350586, 0.017965913470733775};
Code for NDSolve
eqn =
{x[i]''[t] ==
Sum[
If[j == i,
0,
(-μ[[j]] (x[i][t] - x[j][t]))/((x[i][t] - x[j][t])^2 + (y[i][t] - y[j][t])^2)^(3/2)],
{i, 3}, {j, 3}],
y[i]''[t] ==
Sum[
If[j == i,
0,
(-μ[[j]] (y[i][t] - y[j][t]))/((x[i][t] - x[j][t])^2 + (y[i][t] - y[j][t])^2)^(3/2)],
{i, 3}, {j, 3}]};
var = Table[{x[0] == rx[[i]], y[0] == 0,[x]'[0] == 0, [y]'[0] == v[[i]]}, {i, 3}]
soln = Table[NDSolve[{eqn, var, {x[i], y[i]}}, {t, 0, 365.2}], {i, 3}];
Problem
When I run this, I recieve the following error:
NDSolve::argm: NDSolve called with 2 arguments; 3 or more arguments are expected.
What is wrong with this code?
NDSolve
in{}
. $\endgroup$NDSolve[{eqn, var}, {x[i], y[i]}, {t, 0, 365.2}]
$\endgroup$