# Problems solving/plotting a differential equation

I am trying the following:

Plot[DSolve[{1220*x''[t] + 1000*x'[t] + 35600 x[t] + 4500*x[t]^3 +
2135 == 0, x == 0, x' == -5}, x, t], {t, 0, 10}]


Could someone please point me in the right direction? I am just getting the same input if I just try:

DSolve[{1220*x''[t] + 1000*x'[t] + 35600 x[t] + 4500*x[t]^3 +
2135 == 0, x == 0, x' == -5}, x, t]


I have used Mathematica to solve these kinds of equations before but I'm drawing a blank here. It's just the good ol' mass-spring-damper system.

• If DSolve cannot solve the DE, which seems to be the case, you can use NDSolve to get a solution that you can plot. Would that be okay, or do you need the symbolic solution? Apr 12 '15 at 23:13
• NDSolve gives me: x[t] -> Interpolating function. I just really need to plot it. A symbolic solution would be nice, but not necessary. Apr 12 '15 at 23:18
• Yep. The documentation shows examples of plotting the result. Does that work? Apr 12 '15 at 23:19
• Mmmm.. I can't seem to get it to work. I'll fiddle with it some more. I have never seen said output. Mathematica rookie :) Apr 12 '15 at 23:27
• It's just the good ol' mass-spring-damper system. Well, it is a special spring you have and not the good old one. You have non-linear spring, so this makes it hard to find closed form solution. Are you saying Mathematica solved this analytically before? Apr 12 '15 at 23:30

You can use NDSolveValue:

ClearAll[xfunc1, x, t]
xfunc1 = NDSolveValue[{1220*x''[t] + 1000*x'[t] + 35600 x[t] +
4500*x[t]^3 + 2135 == 0, x == 0, x' == -5}, x, {t, 0, 10}];
Plot[xfunc1[t], {t, 0, 10}] Or use NDSolve and ReplaceAll to get the solution function:

ClearAll[xfunc2, x, t]
xfunc2 =  x /. NDSolve[{1220*x''[t] + 1000*x'[t] + 35600 x[t] +
4500*x[t]^3 + 2135 == 0, x == 0, x' == -5}, x, {t, 0, 10}][];

Plot[xfunc2[t], {t, 0, 10}]
(* same picture *)


Use NDSolve

sol = NDSolve[{1220*x''[t] + 1000*x'[t] + 35600 x[t] + 4500*x[t]^3 + 2135 == 0,
x == 0, x' == -5}, x, {t, 0, 10}];

Plot[Evaluate[x[t] /. sol], {t, 0, 10}, PlotRange -> All] 