Re: Is Runge-Kutta the right approach here ??



monir wrote:
On Apr 20, 12:56 pm, spellu...@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
(Peter Spellucci) wrote:
In article <1177024754.070644.320...@xxxxxxxxxxxxxxxxxxxxxxxxxxx>, monir <mon...@xxxxxxxxxxxx> writes:

>Hello;
>At time t1: the location w(=x,y,z) and the velocity dw(=dx/dt, dy/dt,
>dz/dt) are known.
>I need to advance the solution over a small interval dt using the
>Runge-Kutta method.
>The subroutine for evaluating the derivatives at the 3 steps is:
>Subroutine DWbyDT(t, w, dw)
>where w is a 1D array containing x, y, z; and
> dw is the returned 1D array containing dx/dt, dy/dt, dz/dt
>
>The solution is very suspicious!!
>Do you see a problem with the above from a mathematical stand point??
>
>Thank you in advance.
>Monir
>

w(t+delta_t)=w(t) + integral(t to t+delta_t) dw(tau) d(tau)
so far, so good.
now you want to do the integral by using an ode

dw(tau) = F(tau,w(tau))

using something like

integral(t to t+delta_t) F(tau,w(tau)) d(tau) =

delta_t/6*(K1 + 2*K2 +2*K3 +K4 )

I must guess this, you didn't state which Runge-Kutta type formula you
want to use, but "I have it at time t and use 3 steps" sounds like this.

here K1,K2,K3,K4 are approximations to F(t,w)(=K1) ,
F(t+0.5*delta_t,w(t+0.5*delta_t)) (K2,K3) and F(t+delta_t,w(t+delta_t))

with
K1=F(t,w)
K2=F(t+0.5*delta_t,w+0.5*delta_t*K1)
K3=F(t+0.5*delta_t,w+0.5*delta_t*K2)
K4=F(t+delta_t,w+delta_t*K3)

if F is a smooth function, delta_t sufficiently small, there should be nothing
suspicious. this is the "classical" fourth order Runge Kutta scheme.
maybe you made an error in coding DWbyDT(t, w, dw) (I assume this dw is my "F")

hth
peter

Hi Peter;
Thank you kindly for your reply.
Couple of points:
1. I'm using the Runge-Kutta 4th order integration scheme and I'm
familiar with the method dealing with one independent variable (t) and
one dependent variable (x).
2. my concern is whether the scenario I described earlier in my post
should be treated as PDE and not as ODE because of the multiple
variables x,y,z at t.
{needles to say there's always the possibility of coding errors in
DWbyDT() !!}

Thanks again.
Monir

If you have one independent variable (t in this case) it is an ODE. It
doesn't matter how many dependent variables you have.
Fred
.