# NDsolve for differential equations [closed]

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.0002959122082834964543838926328576059910.122911634152604,
8.88769244878024109007084412458.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?

• Don't wrap all the arguments to NDSolve in {}. Oct 23, 2019 at 10:00
• So it should be: soln = Table[NDSolve[eqn, var, {x[i], y[i]}, {t, 0, 365.2}], {i, 3}]; ? Oct 23, 2019 at 10:02
• Sorry it's not clear what your code is supposed to do. Oct 23, 2019 at 10:13
• its a system of coupled ODE's to show the acceleration of a body due to gravitational forces of other bodies, ive updated the question with more detail. I hope this helps Oct 23, 2019 at 10:17
• To get three arguments, try moving one brace: NDSolve[{eqn, var}, {x[i], y[i]}, {t, 0, 365.2}] Oct 23, 2019 at 10:57