Re: Differential Eq.

*To*: mathgroup at smc.vnet.net*Subject*: [mg106518] Re: [mg106478] Differential Eq.*From*: Daniel Lichtblau <danl at wolfram.com>*Date*: Fri, 15 Jan 2010 03:18:42 -0500 (EST)*References*: <201001141047.FAA19753@smc.vnet.net>

Jamil Ariai wrote: > Hi All, > > Can anybody kindly tell me how I can solve the following differential equation, with (x[0], x'[0]) = (0, 0): > > x''[t] -x[t] + g[t] = 0, > > where > > g[t] = b*v, for x'[t] > v, > g[t] = b*(x'[t]-u), for Abs[x'[t]-u] < v, and > g[t] = -b*v. > > Take b = 5, v = 0.2, and u = 0.1. Draw x[t] vs t, and x'[t] vs x[t]. > > Thanks. > > J. Ariai Could set it up as below. soln = First[ With[{b = 5, v = 0.2, u = 0.1}, With[{gt = Piecewise[{{b*v, x'[t] > v}, {b*(x'[t] - u), Abs[x'[t] - u] < v}}, -b*v]}, NDSolve[{x''[t] - x[t] + gt == 0, x[0] == 0, x'[0] == 1.15}, x[t], {t, 0, 3}]]]] If your initial derivative is one or less, the default handling seems to run into trouble at one of the switches. I do not know why. Possibly some Method or other settings can improve on that. Daniel Lichtblau Wolfram Research

**References**:**Differential Eq.***From:*Jamil Ariai <j_ariai@hotmail.com>