POV-Ray : Newsgroups : povray.advanced-users : Runge-Kutta : Re: Runge-Kutta Server Time
28 Jul 2024 12:25:33 EDT (-0400)
  Re: Runge-Kutta  
From: Thies Heidecke
Date: 22 Aug 2005 16:02:41
Message: <430a2f61$1@news.povray.org>
"Orchid XP v2" <voi### [at] devnull> schrieb im Newsbeitrag 
news:430a208d$1@news.povray.org...
>> hope that get's you started :)
>
> I guess the main problem is that physics equations typically involve the 
> *second* derrivative of position - whereas RK seems set up for the first 
> order only. From what I can see in your workings, the trick is to write 
> the two terms as a matrix...?

the trick is that you can write an n-th order linear differential equation
as n first order equations by introducing 'helper-variables'.
In the simple example of the harmonic oscillator you replace this 2nd order
diff. eq. of position by two first order diff. eqs. of position and 
velocity.
Thereby you can avoid the second derivative of position with respect to time
because you can replace it with the timederivative of velocity:
 x''(t) = -k/m*x(t)               [1]
 x'(t)  = v(t)                    [2]
 x''(t) = v'(t)                   [3]
with [3] you can replace the x''(t) in [1] with v'(t), so [1] becomes
 v'(t) = -k/m*x(t)
Together with [2] you get the first order system:
 x'(t) = v(t)
 v'(t) = -k/m*x(t)

The matrixform is just to get another perspective on this
(if you're into linear algebra) and it's also a convenient way to write
linear relations. But it's not necessary to be solvable by RK4-methods.
You can use the same idea to turn a nonlinear differential equation
into a system of equations. For example:
 x'''(t)+2*x''(t)^2-x'(t)+Sin(x(t))+Exp(t)=0
can be broken down by some new helper variables y(t) and z(t):
 x'(t)  =y(t)
 x''(t) =y'(t) =z(t)
 x'''(t)=y''(t)=z'(t)
then we can write:
 x'(t)=y(t)
 y'(t)=z(t)
 z'(t)=-2*z(t)^2+y(t)-Sin(x(t))-Exp(t)

As long as the differential equation is in explicit form it's easy to get
it into RK4-compatible form.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.