POV-Ray : Newsgroups : povray.off-topic : Still random : Re: Still random Server Time
29 Sep 2024 19:20:35 EDT (-0400)
  Re: Still random  
From: scott
Date: 8 May 2009 06:24:41
Message: <4a040869@news.povray.org>
> Well, I don't know about that, but physics is mostly about forces, and 
> forces generate acceleration, and force is usually a function of position 
> (or perhaps velocity). Hence differential equations seem to be kind of 
> ubiquitous in physics.
>
> Interestingly, a trivial differential equation has exponential growth as 
> its solution, but you never see this in mechanical systems.

Diesel engines would destroy themselves without a control system to keep the 
speed down, that's the best I can come up with now of a mechanical system 
with exponential growth.  I think the key point is that most things have a 
force that acts in the opposite direction of the movement, which usually 
keeps things stable and also produces the oscillations.

> I thought a Taylor series is just a way of constructing a polynomial 
> approximation to a function that you don't have any better way to compute.

Indeed, so if we can estimate the derivatives by some numerical method, we 
should be able to estimate how the actual function goes forwards, at least 
for a little while.

> And taking 4 linear steps uses the result of the previous steps for the 
> next one.

But it doesn't use the results to go back and work on the *same* part of the 
function to improve the accuracy, it just blindly moves onto the next time 
step ignoring whatever errors might have been present.

> I don't get why taking those steps, throwing the result away and just 
> keeping the intermediate results, and then mixing that all together gives 
> a better result. (Altough it clearly *does*.)

Another way to look at it I guess is that RK4 is effectively estimating 
"deeper" derivatives, like x'' and x''' to better estimate how the function 
goes.

>> I also find that keeping momentum as a state variable rather than 
>> velocity (which would also work) avoids some of the confusion with the 
>> differential of position in the algorithm.
>
> Perhaps.

It's also crucial when you come do doing rotations as well as linear 
movements.  For linear movements you can simply add on the accerlation times 
dt to the velocity, then the same for position.  But you cannot do this for 
angular movements, you need to add on the torque to angluar momentum, use 
that to calculate a thing called spin, then add that onto the angular 
orientation.

> I don't follow. (I.e., I don't see how the final formula is remotely 
> related to RK4.)

Try writing a function to estimate x' x'' and x''' of a function at a 
certain time and position.  Then use it to predict what the value of x will 
be at the next time step based on the Taylor Series expansion.  Then, 
assuming you are estimating the derivatives in the "correct" way, you can 
simplify your solution and you'll end up with the RK4 algorithm :-)  I have 
no idea what mathematical jiggery pokery you'll need to do that, but that is 
essentially what RK4 is doing.

Euler integration estimates the next value by assuming:

x = x + dt x'

ie it will perfectly match a function like x = 4 + 5t

RK4 estimates the next value by assuming:

x = x + dt x' + 1/2 x'' dt^2 + 1/6 x''' dt^3

ie it will perfectly match a function like x = 4 + 5t - 3t^2 + 45t^4


Post a reply to this message

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