0

I've been trying to do code this for a two or so hours, and I can't seem to do it. Please help..

I am trying to solve the following second-order differential equation:

a(x'[t])^2 + b + c x[t] - m x''[t] = 0

where

{a = 0.00713, b = 0.0175, c = -12.141, m = 0.0044}
x[0]=0, x'[0]=0, x[0.233]=2

I want the answer to be in terms of

x'[t] = [Formula]

I'm expecting the x'[t] graph to be a sort of logarithmic function shaped.

Could anyone code this for me? (I'm currently stumped)

John
  • 3
  • 1
  • 5
  • You've been explained how the to use the functions on Mathematica. As to why your differential equation is wrong is off topic here. Your differential equation is essentially a negatively damped harmonic oscillator, the form is correct for the differential equation you've got. – Feyre Jan 07 '17 at 14:25
  • In both questions, you didn't provide the TWO initial conditions. Could you? – zhk Jan 07 '17 at 14:37
  • By two initial conditions, is this sufficient? 'x[0]=0, x[0.233]=2, x'[0]=0' (sorry, I really don't know much about maths & mathematica yet..) – John Jan 07 '17 at 14:40
  • John that's three conditions, and there is no solution to the equation which meets all three. – Simon Woods Jan 07 '17 at 14:45
  • Hmm... the x[0.233]=2 was found experimentally, so I guess that can be ignored in this equation.

    Then the two initial conditions become x[0]=0, x'[0]=0

    – John Jan 07 '17 at 14:46

2 Answers2

1

This is non-linear, and Mathematica can't solve it. But you can try Series solution. Using Michael E2 method in solving-an-ode-in-power-series

ClearAll[a, x, c, t, b, m];
eq = a (x'[t])^2 + b + c x[t] - m x''[t] == 0
Normal@seriesDSolve[a (x'[t])^2 + b + c x[t] - m x''[t] == 0, 
  x, {t, 0, 3}, {x[0] -> A0, x'[0] -> B0} (*A0,B0 are initial conditions*)

The answer is

Mathematica graphics

This matches Maples's answer for series

restart;
eq := a *( diff(x(t),t))^2 + b + c * x(t) - m* diff(x(t),t$2);
Order:=4;
dsolve({eq=0,x(0)=A0,D(x)(0)=B0},x(t),'series');

Mathematica graphics

Now you can plugin your parameters values in the solution above.

Nasser
  • 143,286
  • 11
  • 154
  • 359
1

In response to your first question, Feyre has explained in great detail the procedure to get whatever you wanted. But it seems, you are still unable to do it. And I suspect this problem arise when you were trying to plot x'[t] from NDSolve. This issue was also addressed by Feyre in his comments and suggested to use NDSolveValue.

Eqn = a*(x'[t])^2 + b + c *x[t] - m *x''[t] == 0; 
a = 0.00713; b = 0.0175; c = -12.141; m = 0.044;
sol = NDSolveValue[ {Eqn, x[0] == 0, x'[0] == 0}, x[t], {t, 0, 2}]
Show[Plot[Evaluate[sol], {t, 0, 2}, PlotStyle -> {Red}, 
  PlotLegends -> {"x[t]"}], 
 Plot[Evaluate[D[sol, t]], {t, 0, 2}, PlotStyle -> {Green}, 
  PlotLegends -> {"x'[t]"}], PlotRange -> All]

enter image description here

Now to see whether the Mathematica agree with the so-called experimental value you stated,

CEData = (Evaluate[sol] /. t -> 0.233)

0.00251695

which is far from close to the data you provided. So, I also checked with Maple,

restart;with(plots):
eq := a *( diff(x(t),t))^2 + b + c * x(t) - m* diff(x(t),t$2);
a:= 0.00713; b := 0.0175; c := -12.141; m := 0.044;
ics:=D(x)(0)=0,x(0)=0;
sol:=dsolve({eq,ics},numeric);
odeplot(sol,[[t,diff(x(t),t)],[t,x(t)]],0..2,color=
[red,green],axes=boxed,legend=["x'(t)","x(t)"]);

enter image description here

sol(0.233)

0.00251697716038847

I think you should recheck your differential equation along with the parameter values.

If you are interested in finding the exact solution then you should follow Nasser's answer?

zhk
  • 11,939
  • 1
  • 22
  • 38