|
|
>> integrate t dt a (v,p) =
>> let
>> a = evaluate (v,p) t dt -- er... where's the rest?
>
> The only difference is that in the evaluate function without the
> supplied derivative, you don't need to update the state, simply return
> the derivative at time t using the initial state.
Er... right... I think...
So just return v and the instantenous acceleration at time t?
It's news to me that C++ supports optional function arguments.
[And while we're on the subject, this is the first example of C++ code
I've ever seen which appears to be comprehensible. Usually it just looks
like gibberish...]
So anyway, it computes several derivatives and takes their weighted
average. That seems simple enough in principle. I rather suspect that in
practice it's spine-tinglingly easy to screw up some tiny detail that
makes the entire algorithm not work properly. There's *a lot* of
individual steps there to get right...
>> I intended (but never got round to) implementing a system where the
>> computer integrates a time step, then integrates it again with twice
>> the resolution, and if the results differ too much, it subdivides
>> further...
>
> A good idea, it's called "adaptive time step".
Mmm, as with all adaptive algorithms, the key is to get the maximum step
size "small enought", and to avoid infinite recursion. (I also wondered
if maybe it would be better to just look at the magnitude of force
changes or something to decide how "stable" the system is at this point...)
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|