# How to solve differential equation with absolute value?

I'm a newbie here, I want to solve this equation for my assignment:

mg - c x'[t] Abs[x'[t]] = m x''[t]


I'm using

DSolve[{mg - c x'[t] Abs[x'[t]] == m x''[t],x'[0]==0,x[0]==32000},x[t],t]


but Mathematica seems very slow to load.

Questions: is there any other way to solve the equation?

Edit: i've tried to change, but still doesn't work

• You should check the boundary conditions: x[0]== 32000 , x'[0] makes no sense! – Ulrich Neumann Dec 30 '18 at 12:15
• The defintion of the ode is wrong: mg - c x'[t] Abs[x'[t]] == m x''[t] – Ulrich Neumann Dec 30 '18 at 12:17
• i forgot to write x'[0]==0 – J. Manopo Dec 30 '18 at 12:29

If you substitute Abs[x'[t]]->Sqrt[x'[t]^2] mathematica can evaluate the ode

DSolve[{mg - c x'[t] Sqrt[x'[t]^2] == m x''[t] }, x[t], t]


Unfortunately the solution cannot be adapted to the inital conditions x'[0]==0, x[0]== 32000

workaraound

The ode only depends on x'[t],x''[t], the substitution x'[t]->v[t] and division by m gives

ode=9.81 - cdm  v[t] Sqrt[v[t]^2] ==   v'[t] (*g=9.81*)


now the ode only depends on parameters cdm=c/m , v0 and can be solved numerically

V = ParametricNDSolveValue[{ode,v[0] == v0 }, v, {t, 0, 10}, {v0, cdm}]
Plot[Table[V[ 0, cdm  ][t], {cdm, {0, .01, .1, .5, 1, 10}}], {t, 0, 1 }, PlotRange -> {0, Automatic}, PlotLabel -> "variation cdm"]


• i've tried it, but still doesn't work. – J. Manopo Dec 30 '18 at 12:39
• The problem seems to be the initial condition x'[0]==0. You give numerical values for the initial conditions, perhaps you can provide the parameter values m, g, ctoo? – Ulrich Neumann Dec 30 '18 at 13:01
• m is 70 kg, g is 9.81, c is 0.5 – J. Manopo Dec 30 '18 at 18:45
• X = NDSolveValue[{m g - c x'[t] Abs[x'[t]] == m x''[t], x'[0] == 0, x[0] == 32000} /. {m -> 70, g -> 9.81, c -> .5}, x , {t, 0, 10}]; Plot[X[t], {t, 0, 10}, PlotRange -> All] – Ulrich Neumann Dec 30 '18 at 18:58
• Thank you so much! – J. Manopo Dec 31 '18 at 3:37