Tag Info

New answers tagged

2

How do I plot the derivatives of the solution You can simply tell NDSolve to also solve for the derivative: sol = First@NDSolve[{x''[t] + x'[t] + 10 Sin[x[t]] == 3, x[0] == 0, x'[0] == 1}, {x[t], x'[t]}, {t, 0, 20}]; Plot[{x[t] /. sol, x'[t] /. sol}, {t, 0, 20}, PlotStyle -> {Red, Blue}, PlotRange -> All, Frame -> True, PlotLegends ...


7

If you really want a parabola primitive from 3 points, you can use Fit to fit a parabola to the three points, Plot to plot it, and Cases to extract the Line primitive from the plot. For example parabola[pts_] := Module[{x, func, xmin, xmax}, func = Fit[pts, {1, x, x^2}, x]; xmin = Min[pts[[All, 1]]]; xmax = Max[pts[[All, 1]]]; Cases[Plot[func, {x, ...


5

EDITED (removal of uglier approach) Here is an approach but it is a little slow: ac[x_] := Total[Boole[#2] #1 & @@@ {{0, 0 < x < 2}, {-2, 2 < x < 6}, {6, 6 < x < 10}, {-2, 10 < x < 22}, {0, x > 22}}] v[w_] := 3 + Integrate[ac[w], w] d[w_] := Integrate[v[w], w] p1 = Plot[ac[t], {t, 0, 25}, ExclusionsStyle -> ...


0

Ok dude, if you want to get convergence on this type of stiffness you need a "more well posed problem", you can't have too much pendulus and little friction at the same time,for avoid confusion this is just a numerical issue. In other words if you want more Pendulos take there biggers! The problem converge on n=4 if r=10.. I personally think this is a ...



Top 50 recent answers are included