Re: Diff. Equations with "Changeable" Parameters

• To: mathgroup at smc.vnet.net
• Subject: [mg51676] Re: [mg51667] Diff. Equations with "Changeable" Parameters
• From: DrBob <drbob at bigfoot.com>
• Date: Fri, 29 Oct 2004 03:38:51 -0400 (EDT)
• References: <200410280344.XAA09833@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

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

No, you haven't; not in Mathematica. This works, however:

NDSolve[{x'[t] == y[t], y[0] == 0, x[0] == 1, y'[t] == x[t] + Sin[t] +
c*y[t]} /. c -> 1, {x, y}, {t, 0, 2Pi}]

or

DSolve[{x'[t] == y[t], y[0] == 0, x[0] == 0, y'[t] == x[t] + Sin[
t] + c*y[t]} /. c -> 1, {x, y}, t]

(Both x and y need boundary conditions.)

or, for your step function example:

c[t_] = UnitStep[t - 1] + UnitStep[t + 1];
Plot[c@t, {t, -2, 2}, PlotRange -> All];
NDSolve[{x'[t] == y[t], y[0] == 0, x[0] == 1,
y'[t] == x[t] + Sin[t] + c[t]*y[t]}, {x, y}, {t, 0, 2Pi}]

Bobby

On Wed, 27 Oct 2004 23:44:48 -0400 (EDT), Krunom Ilicevic <krunom at hotmail.com> wrote:

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

--
DrBob at bigfoot.com
www.eclecticdreams.net

```

• Prev by Date: Re: full QR decomposition
• Next by Date: Re: Precisio in ListContourPlot?
• Previous by thread: Diff. Equations with "Changeable" Parameters
• Next by thread: Re: Diff. Equations with "Changeable" Parameters