# Will I be able to use NDSolve, and then how

So I am completely new to Mathematica, so sorry if this is a dumb question.

I have a set of 3 coupled nonlinear differential equations. They are (a,b,c,D,L constants): $$mx''=Dx'\sqrt{x'^2+y'^2+z'^2}+L(az'-by')$$ $$my''=Dy'\sqrt{x'^2+y'^2+z'^2}+L(bx'-cz')$$ $$mz''=Dz'\sqrt{x'^2+y'^2+z'^2}+L(cy'-ax')$$ And I have initial conditions for $x,y,z,x',y',z'$

Will I be able to solve this for x,y,z? Any help is appreciated!

-
I am confused on the syntax as well. [eqns, u, {t, tmin, tmax}] is in the documentation. So how do I solve for 3 equations? –  yankeefan11 Dec 5 '13 at 17:42
Follow Nasser's lead: write your equations (ODEs and ICs) in terms of x[t],y[t],z[t], and supply them to NDSolve after specifying the values of the constants (you can use a replacement rule like eqs /. {m->1, D->2, L->1, a->.3, b->.2,c->.5} inside NDSolve. Then you will obtain your solution in the form of a list of three interpolating functions. –  Peltio Dec 5 '13 at 17:57

## 1 Answer

Example:

ClearAll[t, x, y, z];
parms = {d -> 1, L1 -> 10, a -> 5, b -> 99, c -> 8, m -> 100};
term = Sqrt[x'[t]^2 + y'[t]^2 + z'[t]^2];
eq1 = m x''[t] == d x'[t] term + L1 (a z'[t] - b y'[t]);
eq2 = m y''[t] == d y'[t] term + L1 (b z'[t] - c y'[t]);
eq3 = m z''[t] == d z'[t] term + L1 (c z'[t] - a y'[t]);
ic1 = {x'[0] == 0, x[0] == 1};
ic2 = {y'[0] == 2, y[0] == 3};
ic3 = {z'[0] == 0, z[0] == 1};


Now call NDSolve

 sol = NDSolve[{eq1, eq2, eq3, ic1, ic2, ic3} /. parms, {x[t], y[t],z[t]}, {t, 0, 10}]


Now can plot the solution, say

  Plot[Evaluate[x[t] /. sol], {t, 0, 10}]


Or the 3 solutions in one plot (can use legends to label them, etc....)

 Plot[Evaluate[{x[t], y[t], z[t]} /. sol], {t, 0, 10}]


ParameterPlot3D per request

 ParametricPlot3D[Evaluate[{x[t], y[t], z[t]} /. sol], {t, 0, 10},
BoxRatios -> {1, .5, .5}, AxesLabel -> {"x[t]", "y[t]", "z[t]"}]


-
A 3D parametric plot would be more appealing :-) –  Peltio Dec 5 '13 at 18:07
How would that work? This is for the trajectory of a baseball, so 1 plot would be amazing –  yankeefan11 Dec 5 '13 at 18:28
@yankeefan11 Please look up ParametricPlot3D in the docs. –  Szabolcs Dec 5 '13 at 18:29
@Peltio, add p3D, is this what you had in mind? –  Nasser Dec 5 '13 at 18:47
@Nasser Yep, that's it. Trajectory in 3D space. –  Peltio Dec 5 '13 at 21:16