I have the following equation I am trying to plot,
$r''=f(r)+\sum_{n=1}^{\infty}a^n \frac{d^n}{dt^n}(f(r))$
and $r$ is a vector in $(x,y,z)$ that are time dependent. I wrote the code as follows,
Clear[x, y, z, t, a];
Dmax = Infinity;
tmax = 10;
r = {x[t], y[t], z[t]};
equation = D[r, {t, 2}] + r/ (r^2 + 2^2)^(1/2) +
Sum[(a^n (D[r/ (r^2 + 2^2)^(1/2), {t, n}])),{n,Dmax};
p = Thread[(r /. t -> 0) - {1.0, 0, 0} == 0];
v = Thread[(D[r, t] /. t -> 0) - {0.0, 1.0, 1.0} == 0];
Equation2 = Join[Thread[equation == 0], p, v];
solution1 =
NDSolve[Equation2 /. a -> 0.0, r, {t, 0, tmax},
MaxSteps -> Infinity,
Method -> {"EquationSimplification" -> "Residual"}];
solution2 =
NDSolve[Equation2 /. a -> 0.1, r, {t, 0, tmax},
MaxSteps -> Infinity,
Method -> {"EquationSimplification" -> "Residual"}];
b1[t_] = r /. solution1;
b2[t_] = r /. solution2;
plot3D1 =
ParametricPlot3D[{b1[t][[1, 1]], b1[t][[1, 2]], b1[t][[1, 3]]}, {t,
0, tmax}, PlotStyle -> Cyan, DisplayFunction -> Identity,
PlotLegends -> {"b1"}];
plot3D2 =
ParametricPlot3D[{b2[t][[1, 1]], b2[t][[1, 2]], b2[t][[1, 3]]}, {t,
0, tmax}, PlotStyle -> {Blue, Dotted, Thickness -> 0.02},
DisplayFunction -> Identity, PlotLegends -> {"b2"}];
Show[plot3D1, plot3D2, PlotRange -> All, BoxRatios -> Automatic,
ImageSize -> 450, ViewPoint -> Above]
Sum[(a^n (D[r/ (r^2 + 2^2)^(1/2), {t, n}])),{n,Dmax}
The issue I have is that NDSolve works for $Dmax=Infinity$ as well as for values of $2,3$, however it fails to solve for values equal and greater than $4$. How do I fix the problem? Why it works at infinity?
Dmax = Infinity
: NDSolve gives error ` NDSolve::ndord: Derivative order K[1] in term (x^(K[1]))[t] should be a non-negative machine-sized integer.` concerning the highest derivative in the ode. $\endgroup$NDSolve
does internally). $\endgroup$