- #1
DivergentSpectrum
- 149
- 15
sorry for spamming the boards with all these questions lol- i promise this is my last post regarding n body problems. how do i measure error? i can't really find much on this subject. i want to use adaptive stepsize in my n body simulator I am guessing for the n-body problem i base my error on energy and angular momentum:
h(n+1)
∫work dt=KEn+1- KEn
h*n
h(n+1)
∫torque*dt=AMn+1-AMn+1
h*n
of course the integrals would be evaluated using simpsons rule, which is equivalent to RK4 in order.
this gives me 4 equations (actually 4*p where p is the number of particles).
now the way i see it i can do this 2 ways:
the work divided by kinetic energy gained should equal 1, and if the fraction isn't close enough to one i repeat the step.
or work minus kinetic energy should equal zero, so i could find the difference and if it isn't close enough to 0 i repeat the step.
i think both of them have their advantages and drawbacks, for example if i went the subtraction route, then if the difference is really small it doesn't really matter if I am dealing with big numbers.
on the other hand, if i use division i might end up with divide by zero problems.
h(n+1)
∫work dt=KEn+1- KEn
h*n
h(n+1)
∫torque*dt=AMn+1-AMn+1
h*n
of course the integrals would be evaluated using simpsons rule, which is equivalent to RK4 in order.
this gives me 4 equations (actually 4*p where p is the number of particles).
now the way i see it i can do this 2 ways:
the work divided by kinetic energy gained should equal 1, and if the fraction isn't close enough to one i repeat the step.
or work minus kinetic energy should equal zero, so i could find the difference and if it isn't close enough to 0 i repeat the step.
i think both of them have their advantages and drawbacks, for example if i went the subtraction route, then if the difference is really small it doesn't really matter if I am dealing with big numbers.
on the other hand, if i use division i might end up with divide by zero problems.