MathGroup Archive 2008

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

Search the Archive

Re: NDSolve with Piecewise function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87905] Re: NDSolve with Piecewise function
  • From: Albert Retey <awnl at arcor.net>
  • Date: Sat, 19 Apr 2008 23:50:30 -0400 (EDT)
  • References: <fuc7ut$a30$1@smc.vnet.net>

Adam Simpson wrote:
> Hi, I am wanting to use NDSolve on a piecewise function but am running  
> into some trouble. Basically what I want to do is this:
> 
> NDSolve[
> {Piecewise[{{FunctionsA, -.001 < x < .001}}, FunctionsB]}
> , {x, y, z}, {t,10^-5}]
> 
> So I have x,y,z as functions of t that I want to solve for and in a  
> certain region of x I want to use a different set of equations. I am  
> not really sure if I can go about it this way or not though. Any help  
> on how to tackle such an equation would be greatly appreciated.
> 
Basically it should work as intended, but remember that you need to give 
arguments to x,y,z in all your equations. The following works:

NDSolve[{
   x'[t] == Piecewise[{{Sin[x[t] + y[t]], y[t] > 0.2}}],
   y'[t] == Cos[x[t] + y[t]], x[0] == 0, y[0] == 0
   }, {x, y}, {t, 0, 1}
  ]

hth,

albert


  • Prev by Date: Re: Defining derivatives
  • Next by Date: Re: Problems to find the local extrema of an InterpolatingFunction
  • Previous by thread: NDSolve with Piecewise function
  • Next by thread: axis alignment of 3D plots with ListContourPlot3D