Explore GR & Newtonian Orbits in HTML/JS

  • Context: HTML/CSS 
  • Thread starter Thread starter m4r35n357
  • Start date Start date
  • Tags Tags
    Gr
Click For Summary

Discussion Overview

The discussion revolves around the development of JavaScript and HTML5 canvas models for simulating orbits under General Relativity (GR) and Newtonian mechanics. Participants share their experiences and code related to these simulations, exploring the differences in orbital behavior predicted by each theory.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant created a side-by-side simulation of Newtonian and Schwarzschild orbits, noting that Euler integration appears to provide better accuracy than the Runge-Kutta method used in previous examples.
  • Another participant expanded on their initial work to include a model of a spinning black hole, using an effective potential approach and custom code for orbital behavior, specifically referencing the orbit of Mercury.
  • There are mentions of potential errors in the denormalization process of the figures used in the simulations, with a request for feedback from others.
  • Participants reference external resources, such as a gravitation orbits simulator, indicating a shared interest in the underlying concepts and methods.
  • There is an acknowledgment of the inspiration drawn from existing applications like GROrbits, with discussions on code size and compatibility with various browsers.

Areas of Agreement / Disagreement

Participants seem to share an interest in the topic and the exploration of GR and Newtonian orbits, but there is no explicit consensus on the accuracy of the models or the best methods to use. The discussion remains open-ended with various approaches and ideas presented.

Contextual Notes

Participants express uncertainty regarding the accuracy of their models and the potential for errors in their implementations. There is also a mention of the need for adjustments in the simulation parameters to observe specific effects.

m4r35n357
Messages
657
Reaction score
148
OK, just a bit of fun . . . hope no-one is too offended ;)

Inspired by the Newtonian orbit example here: http://www.travisglines.com/tag/runge-kutta, I thought I'd see how much GR I could do in JavaScript/HTML5 canvas. So, I got a side-by-side Newton/Schwarzschild demo going, code here: https://www.box.com/s/a514bd0a108e7717ab09. I stopped when I got bored, and I'm not into HTML, so I didn't make any controls for it; there are two scenarios commented in the JS code which you will need to edit to taste. By default it displays a borderline unstable decaying circular orbit against the Newtonian "equivalent", using the effective potential equations from MTW chapter 25 (Euler integration seems be more accurate than the RK4 on the original site, which has horrible precession for a Newton orbit).

Feel free to take/use/ignore with impunity, I'm sort of leaning towards trying a Boyer-Lindquist version, but not decided yet.

Of course, if you are looking for accuracy just go with GROrbits!
 
Technology news on Phys.org
OK I went quite a bit further than I had originally planned, and so we now have a JavaScript/HTML5 canvas model of a spinning black hole in the equatorial plane, again up against Isaac's vision.
It uses an "effective potential" approach, with Euler integration and my own "turnaround" code. If you see precession in the Newton trace, you need to reduce the timestep.
It starts up with a reasonable approximation to the orbit of Mercury, you have to "zoom in" quite a lot to see the effects of GR (hopefully the input controls make sense).
I checked the geometrized figures against GROrbits, but to add a touch of reality I have attempted to "denormalize" everything to more everyday units; I might have made errors at this stage, please let me know if anyone finds any . . .
Anyway, Voila!

https://www.box.com/s/vfznxq5ymhg5zjyoeqds
 
pervect said:
You might take a peek at http://www.fourmilab.ch/gravitation/orbits/, if you haven't already.
Ha, I had no idea that was yours! In fact that applet and later GROrbits were the inspiration for what I have done ;) I built them both in Eclipse and had a good rummage in the code, and wondered how far the basic engine could be stripped down, for learning purposes (mine or anyone else's).
My claim to notoriety is mainly down to the tiny code size (there is a commented out Schwarzschild model that can be deleted, also I haven't tried minifying . . .), also it can run and be debugged in any of the open source browsers (hint: not tested on any version of IE).
I do hope we can all coexist in harmony ;)
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 8 ·
Replies
8
Views
6K
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 2 ·
Replies
2
Views
3K