Schroedingers-Hat / jsphys

Libraries for physics simulation on javascript canvas
GNU Affero General Public License v3.0
11 stars 1 forks source link

Possible uses continued #39

Open Schroedingers-Hat opened 13 years ago

Schroedingers-Hat commented 13 years ago

See the description of the milestone -- in hindsight that was a bad place to put it.

In the last episode of this gripping adventure we got up to the uses for objects described by functions. This gave us methods which could gives us a good look at the stars and the cosmos, learn the physics of our virtual world (and possibly monkey with them a bit to teach people how to astronomy/cosmology). Now it's time to look closer to home.

The next class of object is something controlled by general ODE. This is where things start getting a little more convoluted. You can't find out where it is at an arbitrary time, and you can't be sure that it well even wind up in the same place as it did last time you ran the ODE. A way around this is to record some anchor points as you go. We can save the first few terms of the taylor expansion of its motion every now and again and use them to interpolate. We should be able to find a good balance between cpu time and memory to produce a few thousand of these. Because the objects necessarily persist and retain information through time this opens up a few more possibilities. We can do the twin paradox without cheating, these objects can be illuminated by the player, be remote controlled probes on mars or alpha centauri along with sending back 'telemetry' (which could be suitably doppler shifted). We can also make one of these with the propagation rule 'do what I do'. This way, if you teleport you can see yourself doin' your thing, or if you're really tricky you can go and visit. Sadly we lose our 'only pay attention to what is interesting' optimization at this point, we have to keep track of these any time our light cone is getting near the last calculated value, or suffer through Loading... when one comes into view.

The other thing that this permits is a whole host of normally Newtonian low speed goodness. Basically anything we can get hold of a Lagrangian for (and solve for the equations of motion). Think all the balls in frictionless vacuums you've ever done, but with friction, and air. SR+air resistance seems a little silly, but there ya go. The concept of 'ground' is still going to be alien to the engine at this point (unless it's one of the constraints in the Lagrangian), but again, cheating is an option. Collision detection is also often expensive, not sure if there'll be any room left in the budget for it -- no reason we can't split the integrator off into a Newtonian world.

Even stuff that is not Lorentz invariant will work as well as it would in a Newtonian setting -- albeit with wasted calculation. We can re-use some light delay/doppler code (with minor modification to separate signal doppler from time dilation) to play some tricks with sound, too. Whether we want to add code for playing sounds, or just display the numbers/waveforms is another matter.

The final feature is a PDE integrator. Now that we know where everything was, we can tell a particle what to do in response. Objects acting in this way will be expensive, each object will be about as expensive as updating a whole 'nother frame -- that is if it's nearby. If it's far away then we lose a fairly large portion of our optimization, basically we need another time step worth of computation, and we need to keep track of another lot of objects that it's going to interact with. Fortunately for rigid bodies and such, we can hang a big bunch of inertialObjects off of it (the displacements point from the interactive object to the inertialObject, rather than from your position), so we won't need too many. of them. Until now we would have had to laboriously solve orbital equations by hand (or generate them from a template) and there was no chance of doing any interesting electromag. This type of object will allow the player to plonk a planet down, or go into orbit themselves. We could devise scenarios where they have to do orbital mechanics correctly.

It allows exploration of a lot of electrodynamics, working in the coulomb gauge is natural, and allows magnets (electromagnets at least, I don't think I'm implementing spin, somehow) to work correctly with no mention of fields. This will make the links between SR and Electromag strongly apparent. I was also thinking we could attach a little flow field detector thingy to the player (would work best in 2D), with little paths that showed you where a particle would go were it released there. It'll give us some access to what we normally think of as field information.

I haven't looked into doing it without fields, but gravitomagnitism would be a strong possibility, too. We can fake gravitational time dilation from the Newtonian potential and work from there.

That just about exhausts the possibilities I can think of.

TLDR version: I think this engine with all the v1 features is capable of demonstrating any principle in physics, sans quantum, fields, GR, and fluid mechanics. Different applications require differing levels of extension, but this is about possibilities, not things we're actually going to do.

Also, I can't think of any way to handle ray optics, without just going and programming a completely independant ray optics method. It seems like it should be possible, but I'm at a loss for how.

Schroedingers-Hat commented 13 years ago

relativistic minigolf :D The ball has to be length contracted to fit through the gap, etc. Could also teleport ahead of the ball to hit it while it is still moving. Points for number of boosts, and number of teleports. Can't think of how to include light-effects in this. Perhaps limited radiation resistance? "Too much luminous flux. Shields failing. Ball vaporized." Has nice ring to it. That takes care of doppler and headlight. Aberration is harder.

Schroedingers-Hat commented 13 years ago

Relativistic horse-betting. Run towards the track really fast to ensure your horse wins.