MathGroup Archive 2011

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

Search the Archive

Re: NDSolve, three 2-d order ODE, 6 initial conditions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115189] Re: NDSolve, three 2-d order ODE, 6 initial conditions
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Tue, 4 Jan 2011 04:22:45 -0500 (EST)

Perhaps a call to ndSol with some parameters (known only to you) will  
cause an error message... but the statement you posted, as it is, gives NO  
error message.

That said, it seems to me that {t, t1} needs replacement with something  
like {t, t1, t2}, as NDSolve needs lower AND upper limits.

{x[t], y[t], z[t]} should be {x, y, z}, since NDSolve will return  
InterpolatingFunction results, not symbolic ones.

Though it's not necessary, I'd also replace D[x[t], {t, 2}] with x''[t],  
D[x[t], t] with x'[t], and (D[x[t], t] /. {t -> 0}) with x'[0].

The result is

ndSol[w_,w0_,w1_,x0_,y0_,z0_,v0x_,v0y_,v0z_,t1_,t2_]:=NDSolve[{-w Sin[t w]  
(x^\[Prime])[t]+w Cos[t w] (y^\[Prime])[t]+Cos[t w]  
(x^\[Prime]\[Prime])[t]+Sin[t w] (y^\[Prime]\[Prime])[t]==(w-w0) (Sin[t w]  
(x^\[Prime])[t]-Cos[t w] (y^\[Prime])[t]),-Sin[t w]  
(x^\[Prime]\[Prime])[t]+Cos[t w] (y^\[Prime]\[Prime])[t]==(w-w0) (Cos[t w]  
(x^\[Prime])[t]+Sin[t w] (y^\[Prime])[t])+w1 (z^\[Prime])[t],0==w1 (Sin[t  
w] (x^\[Prime])[t]-Cos[t w1]  
(y^\[Prime])[t]),(x^\[Prime])[0]==v0x,(y^\[Prime])[0]==v0y,(z^\[Prime])[0]==v0z,x[0]==x0,y[0]==y0,z[0]==z0},{x,  
y, z},{t,t1,t2}];

That will fail if w1 == 0, since it causes one of the equations to be  
trivially True, and the equation is unnecessarily complicated when w1 is  
NOT zero.

In case w1 == 0, z is also uncoupled from x and y, and it will be simply

z[t_] = z0 + v0z t

Hence, we could redefine ndSol as:

Clear[ndSol]

ndSol[w_,w0_,0,x0_,y0_,z0_,v0x_,v0y_,v0z_,t1_,t2_]:=
Append[NDSolve[{-w Sin[t w] x'[t]+w Cos[t w] y'[t]+Cos[t w] x''[t]+Sin[t  
w] y''[t]==(w-w0) (Sin[t w] x'[t]-Cos[t w] y'[t]),-Sin[t w] x''[t]+Cos[t  
w] y''[t]==(w-w0) (Cos[t w] x'[t]+Sin[t w]  
y'[t]),x'[0]==v0x,y'[0]==v0y,x[0]==x0,y[0]==y0},{x, y},{t,t1,t2}],z->z0+#  
v0z&]

ndSol[w_,w0_,w1_,x0_,y0_,z0_,v0x_,v0y_,v0z_,t1_,t2_]:=NDSolve[{-w Sin[t w]  
x'[t]+w Cos[t w] y'[t]+Cos[t w] x''[t]+Sin[t w] y''[t]==(w-w0) (Sin[t w]  
x'[t]-Cos[t w] y'[t]),-Sin[t w] x''[t]+Cos[t w] y''[t]==(w-w0) (Cos[t w]  
x'[t]+Sin[t w] y'[t])+w1 (z')[t],0==Sin[t w] x'[t]-Cos[t w1]  
y'[t],x'[0]==v0x,y'[0]==v0y,(z')[0]==v0z,x[0]==x0,y[0]==y0,z[0]==z0},{x,  
y, z},{t,t1,t2}];

Whether that is solvable for the parameters you'd like to pass, I can't  
venture to guess.

Bobby

On Mon, 03 Jan 2011 02:56:52 -0600, michael partensky  
<partensky at gmail.com> wrote:

> Hi, group!
>
> An attempt  to demonstrate a (restricted)  analogy between the Bloch
> (magnetic resonance) equation and the motion equation for a charged  
> particle
> in the magnetic field leads to the following equation:
>
> ndSol[w_, w0_, w1_, x0_, y0_, z0_, v0x_, v0y_, v0z_, t1_] :=
>   NDSolve[{Cos[w t ] D[x[t], {t, 2}] + Sin[ w t] D[y[t], {t, 2}] - w  
> Sin[w
> t] D[x[t], t] + w Cos[w t] D[y[t], t] == (w - w0) ( Sin[w t ] D[x[t], t]  
> -
> Cos[w t] D[y[t], t]),
>     -Sin[w t] D[x[t], {t, 2}] + Cos[w t] D[y[t], {t, 2}] == (w - w0)  
> (Cos[w
> t] D[x[t], t] + Sin[w t] D[y[t], t]) + w1 D[z[t], t],
>     D[z, {t, 2}] == w1 (Sin[w t] D[x[t], t] - Cos[w1 t] D[y[t], t]),
> (D[x[t], t] /. {t -> 0} ) == v0x, (D[y[t], t] /. {t -> 0} ) == v0y,  
> (D[z[t],
> t] /. {t -> 0})  == v0z, x[0] == x0, y[0] == y0, z[0] == z0 }, {x[t],  
> y[t],
> z[t]}, {t, t1}];
>
> Apparently there is an error - u will see the message. Could you please  
> help
>  catching  it?
> Thanks
> Michael Partenskii
>
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: WAV Import[] and Integer16 Issue
  • Next by Date: Re: Combining Slider and SetterBar in Manipulate
  • Previous by thread: Re: NDSolve, three 2-d order ODE, 6 initial conditions
  • Next by thread: Re: NDSolve, three 2-d order ODE, 6 initial conditions