Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

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



  • Prev by Date: Re: Using a huge list of random numbers from random.org
  • Next by Date: Re: Representing musical timings on a helix
  • Previous by thread: NDSolve bug?
  • Next by thread: inverse function wrapper