Hacker News new | ask | show | jobs
by aw1621107 1885 days ago
> For a basic example-numbers implementation, replacing an n-body simulation that updates every 10 seconds, I was imagining that you might update the force vector 1/100th as often, every 1000 seconds. That's plenty fast to accurately handle a multi-day orbit around a lagrange point or a low energy transfer. The paths the craft take should look completely normal.

I'm honestly curious about what Principia's largest step size is when calculating predictions. Best I can tell, the step size starts large and shrinks until the tolerance-to-error ratio is small enough [0]. I can't seem to figure out how large the initial step is, though.

But in any case, I suppose it'd come down (again) to how important accuracy is.

I'm now extremely tempted to fire up KSP with Principia to see what happens if I were to mess with the timesteps. Don't think I'm familiar enough with the codebase to mess around with it properly, though.

> If you then combine a normal single-influence orbit with that force vector, you could summarize 1000 seconds of orbit into one moderately complex equation.

A lot hinges on the combination being as simple as the sentence makes it look. I'm not entirely convinced that the analysis is straightforwards (fewer forces, but you might lose some useful properties) but I'll be the first to admit that I'm not exactly an expert on this subject.

I really wish I had more time and knowledge; this sounds like a good candidate for some test code. I have absolutely no faith I'd be able to pull off something proper, though; good n-body integrators are well out of my skill range, and I don't know how I'd even begin approaching your proposed scheme outside naive integration (which wouldn't exactly be a fair comparison to high-quality n-body integrators).

Did you have a particular method of combination in mind?

> Treating the forces as constant over a stretch of time, when they actually are almost constant, shouldn't have all that much error, unless I'm missing something glaring.

Well, maybe; I'm honestly not confident enough in the possible models I had in mind to stand behind what I said (I was thinking in terms of the relative magnitude of the "correction" of the second force, but looking back I'm not entirely sure how relevant that is). I really shouldn't have been so confident in that particular line of questioning. Sorry about that.

[0]: https://github.com/mockingbirdnest/Principia/blob/f84c96953a...

1 comments

I don't know what a good force integration looks like in the first place, so I can't really help design the needed calculation, sorry. But I imagine you'd use similar techniques in many ways to get good accuracy.
I found the Ahmad-Cohen scheme [0, PDF] (through [1]), which seems related to what you describe:

> Our scheme takes advantage of this fact by dividing the force on a particle into two parts: a slowly varying part which is due to the "distant" starts, the regular force, and another component, the irregular force, due to the stars in the immediate neighborhood of the star in question.

[2] has a bit more performance info:

> The gain by using by using the Ahmad-Cohen scheme is expressed as (N/3.8)^(1/4) for both the fourth-order standard and Hermite schemes, but would be significantly smaller on vector or parallel machines.

I think Principia currently has info for 34 bodies, so I think the improvement would be on the order of 1.73x according to that equation if the Ahmad-Cohen scheme is implemented (and is applicable).

That being said, I believe it still involves integration, as opposed to the hypothetical closed-form solution in your scheme. If no useful closed-form solution exists for the scheme you describe, then the Ahmad-Cohen scheme might be a closer match.

I admit my initial skepticism was at least partially incorrect. You were right that approximating less substantial influences by increasing the timestep could be useful for performance. The sole remaining question is whether you still need to stick with an integration scheme or whether a closed-form approximation exists.

[0]: https://courses.physics.ucsd.edu/2017/Winter/physics141/Lect...

[1]: https://scicomp.stackexchange.com/questions/21949/n-body-sim...

[2]: http://articles.adsabs.harvard.edu//full/1992PASJ...44..141M...