Re: NDSolve bug?
- To: mathgroup at smc.vnet.net
- Subject: [mg127745] Re: NDSolve bug?
- From: DC <b.gatessucks at gmail.com>
- Date: Sat, 18 Aug 2012 03:45:03 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
- References: <k0ksom$66f$1@smc.vnet.net>
Removing the `=` in the inequalities seems to work :
g = 9.81;
b = 0.;
c = 1.0;
x0 = 0.001;
v0 = 1.001;
sol = First[
x /. NDSolve[{x''[t] ==
Piecewise[{{-g - b*x'[t], x[t] > 0 && x'[t] > 0}, {-g - c*x'[t],
x[t] > 0 && x'[t] < 0}, {g - b*x'[t],
x[t] < 0 && x'[t] < 0}, {g - c*x'[t],
x[t] < 0 && x'[t] > 0}}, 0.], x'[0] == v0, x[0] == x0},
x, {t, 0, 1}, MaxSteps -> \[Infinity], AccuracyGoal -> 3]]