Principia

Using three.js 3D library to teach physics, programming and encourage young nerds.

Principia is a JavaScript library who offers virtual experiments to test and learn the laws of physics. This is not a perfect simulator, but it's good enough to have fun and enjoy the science for a while playing with the Universe in God mode.


Newton's Laws

Newton Laws are as beauty as powerful in their simplicity.

Newton's 1st law (Law of Inertia)

Newton was clever enought to understand the true nature of movement is to keep on moving forever unless something stops it. This is called Uniform Motion and it was a counter-intuitive proposal (even nowadays for a lot of people) because everything we start moving in planet Earth surface ends up stopping due to external forces like friction with floor or air.

Let's throw a star with a initial velocity and see what happens

In this experiment there are no surrounding elements who can influence the movement of such a lonely star, so it should go on forever with the initial velocity. This velocity has been stated as "advance a distance equal to one diameter of the star in the path of X axis per second". There will be created new axes every second wherever the center of the star is, and because of Newton's first law they should appear separated by one star diameter each other. Go to experiment

Newton's 2nd law (Force generates acceleration)

When a force is applied to a body, it will gain velocity gradually (this is called Accelerated Motion). But it doesn't applies the same way to all bodies, because the more mass it has, the less acceleration it will get (its velocity will increase in a slower manner), just like pushing with the same force a skateboard or a car.

Let's drop a small version of planet Mercury to the Sun

Physical objects (the ones who has mass) generate a force among them called "gravity" (more about this later). This force makes things fall towards the cented of the Earth or, in this case, the Sun. We can drop a stone, an apple or, in this case, a full planet like Mercury. Acceleration means velocity will grow gradually every second, so the distance the body advances will "double" grow every second (according to the square of the elapsed seconds). There will appear axes every ten seconds in the center of Mercury as it is falling, and you will realize the distance among axes gets bigger and biger through time (one diameter, two, tree...). Go to experiment

Note some extra details: Mercury has been reduced (just as "tiny" as one and a half mount Everest) to make its diameter fit in this experiment, placing it in that precise starting point and pushing it with a precise initial velocity so it can advance in the required steps. Detailed calculations are shown in source code. Another interesting detail is gravity force is not constant, because it varies with the distance to the center of the Sun in this case, so the closer it gets the stronger is the force. If you look closely tho the last axes you will notice they are getting closer to the Sun than it was supposed to be.

Newton's 3rd law (Action-Reaction Law)

All forces between objects exist in equal magnitude and opposite direction. If one object pushes a force on a second object, the second one pushes the same force on the first one, but oppsite, just like pushing someone over ice, he will move forward, but you'll move backwards. Same applies to pulling. The net sum of all the interaction forces of all objets will add up to zero.

Let's drop two identical Suns, one towards each other

Two identical objects will get attracted with same force intensity each one, so they will meet at the midpoint. Because stars are so huge and distnces are really, really big, they are going to spend more than eight hours to start touching at the end of the fall, we have accelerated time to make it one thousand faster (1 life second = 1000 simulated seconds) so you do not get bored. One new axes set will be drom every hour at the center of each star. Go to experiment

Please notice the centers of both objects was separated 3 million Kilometers each to the coordinates origin (marked at the center of the big axes) so, being both affected by two equal opposite forces, they end up at very center, as it should be. The distances they are marking every hour are increasing in a similar accelerating pattern as the one we saw in the second law example.


Orbital Movement

When Uniform Motion and Accelerated Motion (derived from gravity forces) are combined, some magic happens. If the resulting movement is a periodical loop, it is called Orbital Motion. All those beautiful movements have been generated with the solely equations of the three Newton Laws.

Solar Systems

We have an excellent example in the neiborghood. We call it Solar System, and it is well known with known masses and velocities, but we can imagine other solar systems...

Inner Solar System

let's watch a subset of our Solar System, made up of the rocky planets (Mercury, Venus, Earth and its Moon and Mars). Initial distances to Sun and velocities are the average ones that appears in Wikipedia, but they are not precisely placed at the actual locations in a determined date (they are all aligned in the X axis). Go to experiment

Inner Binary Solar System

What would happen in the Solar System if there would be a second Sun in it? Zoom it out and scale it to max (pressing > x5) and then accelerate time one million times faster (pressing + x6) to be witness of chaos. Go to experiment


View in GitHub