Re: Diff. Equations with "Changeable" Parameters
- To: mathgroup at smc.vnet.net
- Subject: [mg51680] Re: Diff. Equations with "Changeable" Parameters
- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
- Date: Fri, 29 Oct 2004 03:38:58 -0400 (EDT)
- Organization: Uni Leipzig
- References: <clpsou$abt$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, 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}] Regards Jens "Krunom Ilicevic" <krunom at hotmail.com> schrieb im Newsbeitrag news:clpsou$abt$1 at smc.vnet.net... >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. > >