Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: NDSolve bug?
Replies: 1   Last Post: Aug 18, 2012 3:44 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
DC

Posts: 77
Registered: 8/22/07
Re: NDSolve bug?
Posted: Aug 18, 2012 3:44 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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]]




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2013. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.