MathGroup Archive 2004

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

Search the Archive

Re: Diff. Equations with "Changeable" Parameters


a) you do not solve
> NDSolve[{x'[t]=y[t],y[0]=0}, {y'[t]=x+Sin[t]+c*y[t]},{x,y},{t,0,2Pi}]

 because it is full of errors, for equations you have to use Equal[] == and 
not Set[] =,
there is no initial condition for x[0] and in the last differential equation 
a x[t] is missed.

b) in your question c is simply a function of y and you should define a 
function c[y] with
c[y_?NumericQ] /; y < -1 := 0.0
c[y_?NumericQ] /; -1 <= y <= 1 := 1.
c[y_?NumericQ] := 2.0

and type the correct version of the NDSolve[] command

NDSolve[{x'[t] == y[t], y[0] == 0, x[0] == 0,
y'[t] == x[t] + Sin[t] + c[y[t]]*y[t]}, {x, y}, {t, 0, 2Pi}]



"Krunom Ilicevic" <krunom at> schrieb im Newsbeitrag 
news:clpsou$abt$1 at
>I have solved diff. equations in this kind of a way:
> and parameter c was 1, but how to write this algorithm if c is:
> c=0, if y<=-1
> c=1, if -1<y<1
> c=2, if y>=1
> How to include this variable parameter c in my NDSolve method?
> Thanks.

  • Prev by Date: Re: full QR decomposition
  • Next by Date: Re: full QR decomposition
  • Previous by thread: Re: Re: Diff. Equations with "Changeable" Parameters
  • Next by thread: Does anybody out there know how to use the categorylists function for p-variate date