MathGroup Archive 2004

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

Search the Archive

Re: Diff. Equations with "Changeable" Parameters

  • To: mathgroup at smc.vnet.net
  • Subject: [mg51693] Re: Diff. Equations with "Changeable" Parameters
  • From: p-valko at tamu.edu (Peter Valko)
  • Date: Fri, 29 Oct 2004 03:39:37 -0400 (EDT)
  • References: <clpsou$abt$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

You need an initial condition for x as well.
Then a right hand side function definition is handy:

f[x_, y_] := x + Sin[t] + 1*y; -1 < y && y < 1;
f[x_, y_] := x + Sin[t] + 0*y; y <= -1;
f[x_, y_] := x + Sin[t] + 2*y; 1 <= y;

NDSolve[{x'[t] == y[t], y'[t] == f[x[t], y[t]], 
   y[0] == 0, x[0] == 0}, {x[t], y[t]}, {t, 0, 2Pi}]

The result will be:
{{x[t] -> InterpolatingFunction[{{0., 6.28319}}, <>][t], 
  y[t] -> InterpolatingFunction[{{0., 6.28319}}, <>][t]}}

Regards
Peter

"Krunom Ilicevic" <krunom at hotmail.com> wrote in message news:<clpsou$abt$1 at smc.vnet.net>...
> I have solved diff. equations in this kind of a way:
> 
> NDSolve[{x'[t]=y[t],y[0]=0}, {y'[t]=x+Sin[t]+c*y[t]},{x,y},{t,0,2Pi}]
> 
> 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: Another bizarre phenomenon
  • Next by Date: Re: full QR decomposition
  • Previous by thread: Re: Diff. Equations with "Changeable" Parameters
  • Next by thread: Re: Re: Diff. Equations with "Changeable" Parameters