5 ms·
Infinite Force? Forty-year-old Fortran to the rescue
- dietrichepp 11y agoI'd like to say to everyone starting out doing math with computers: You see that old book of numerical recipes or physics problems done in Fortran? Yeah, those are pretty damn good recipes. Do you need some weird function, like a gamma function or hypergeometric function? Maybe you want to minimize a function with simulated annealing or you want to design a Chebyshev filter? You can dig up a library somewhere or you can just look in that dusty old book on the shelf. There's a C version but the Fortran version is easier to find.
- cwyers 11y ago> You see that old book of numerical recipes or physics problems done in Fortran? Yeah, those are pretty damn good recipes. If I don't have that book, what's a good one to get?
- dietrichepp 11y agoThis is the one I'm talking about: http://numerical.recipes http://numerical.recipes There are others.
- tosseraccount 11y agohttps://www.gnu.org/software/gsl/manual/html_node/ https://www.gnu.org/software/gsl/manual/html_node/
- kirrent 11y agoNumerical Recipes: The Art of Scientific Computing was always my go to reference. It's a classic.
- cowsandmilk 11y agoBut remember, the implementations come with a license agreement, that you may not find acceptable. Here are an example of licenses, the book has some others, but they are not hugely different: http://numerical.recipes/aboutNR3license.html http://numerical.recipes/aboutNR3license.html
- anon4 11y ago> The following license terms and the Disclaimer of Warranty, below, apply to individual purchases of the Numerical Recipes Code download product, and to purchases of the Numerical Recipes Code CD-ROM. So all I have to do is simply pirate it and the restrictions don't apply to me?
- dragonwriter 11y ago> So all I have to do is simply pirate it and the restrictions don't apply to me? The "restrictions" are limitations on permissions which do not exist without the license. So, sure, the restrictions don't apply to you, because you have been given no permissions with regard to the work, so there is no point in imposing conditions on those permissions.
- santaclaus 11y agoTheir code can be kind of buggy and often does not handle corner cases well, however. I've had some of their iterative solvers iterate forever when the initial iterate is the solution, etc.
- stephencanon 11y agoIt's a great reference book, and does a good job of citing the work that you actually want to use for your implementation. The code in the book itself (especially the C and C++ versions) should usually be taken with several large grains of salt.
- douche 11y agoI think porting code from one language over into another is one of the better ways to learn a new language. Especially older, lower-level code. I've probably learned more from rewriting an old school project ray tracer in three or four different languages, or grinding away at utilities to load up Quake and Wolfenstein 3D assets based on the ID code, than I have in my actual day job.
- evincarofautumn 11y agoThis reminds me of something that’s always struck me as odd about large-scale physics simulations: using invariant spacial coordinates when doing a gravitational simulation is totally absurd. Wouldn’t precision problems be much less of an issue if you distorted space according to gravitational influence, as happens in real life?
- bainsfather 11y agoThe 'resources' section of the post has 2 links, e.g. www.ma.utexas.edu/mp_arc/e/03-547.pdf goes through several rather clever transformations of (spatial and/or time) variables to improve accuracy.
- siscia 11y agoI just took a class of dynamic systems and this post struck me. Actually it is possible to model the planets using simple mathematical tools and find a space of solution to the problem (have planets that keep staying together) in an analytic or simil-analytic form. All this can be done on paper, which is actually faster than code integrator but way less cool to watch...
- nickhuh 11y agoThe three body problem though is famous for having no solution in terms of basic functions. I think for your planets model you must have been making different assumptions than in the article.
- siscia 11y agoIn system dynamic you can divide a problem in simple (with a finite number of solution) and complex (with an infinite, fractal shaped, number of solution). If the problem is "complicated" (a lot of strange, ugly, non analytic equation)but simple you can roughly cut the solution space by hand, assuming a small number of solution. If the problem is complex all you can do is looking for cycle and equilibrium point using your intuition about the system or being lucky and find a strage attractor (chaotic behavior) slightly moving the parameter. So, yes, I was to quick writing my reply, you can definitely model the n-body problem, exactly solve it is another beast, check a solution however is still relatively easy...
- musgravepeter 11y agoThere is a vast literature on some simplifications: Circular Restricted Three Body (two bodies in a fixed orbit, third subject to their field) and even two fixed points (Euler Problem). Even here there are complex orbits. Maybe an app unto itself!
- blablabla123 11y agoActually since the earlier 90s there are mathematical proofs showing how to generate infinite velocities using 4 objects. (In the Newtonian framework)
- adrianN 11y agoDo you have a reference?
- blablabla123 11y agoOne guy is called Xia and he proofed it 1994. (For only 4 objects using a non-constructional proof) Here is a reference for an earlier proof with 5 objects: https://en.wikipedia.org/wiki/N-body_problem#cite_note-34 https://en.wikipedia.org/wiki/N-body_problem#cite_note-34 Update: https://en.wikipedia.org/wiki/N-body_problem#Singularities_of_the_n-body_problem https://en.wikipedia.org/wiki/N-body_problem#Singularities_o...
- musgravepeter 11y agoThanks! There is also a discussion in The Million Body Problem (Heggie & Hut). Looking forward to poking around in this.
- blablabla123 11y agoNo problem! Wow, this sounds fancy, gotta read this!
- musgravepeter 11y agonbody here. Note the Android Lite version 2.0 somehow ended up in Occulus mode in the final APK. A fix is uploading to Google play now! I have no idea how to even turn that on in Unity - so it's a bit of a puzzle!