Skip to content

Visualizing physical systems with python. Click on a picture to run!

Notifications You must be signed in to change notification settings

Humboldt-Penguin/Physics_Simulations

Repository files navigation

Click on the images to run the simulations on GlowScript/Google Colab!

Too long didn't read: See project 3.2 ("Magnetic Vector Field") at the very bottom for the best example of my physics and computer science knowledge.

My Video Lessons


0. Background Information

  • VPython is a library that uses a 3D graphics module called Visual to display 3D objects. GlowScript is a browser-based Python IDE that comes with VPython and Matplotlib.
  • Colaboratory, or “Colab” for short, by Google Research is a hosted Jupyter notebook service that provides free access to computing resources, including GPUs. It is especially well suited to machine learning, data analysis and education.

Controls for GlowScript:

  • Pan ⟶ Shift + left click + drag
  • Rotate ⟶ Right click + drag
  • Zoom ⟶ Scroll wheel
  • Resize ⟶ click + drag at bottom right of display window
  • View code ⟶ "Edit this Program" at top left

1. Basic Systems

1.1. Bouncing Ball

bounce

1.2. Double Pendulum (with Lagrangian Mechanics)

double_pendulum

1.3. Rolling without Slipping (in a circle)

rolling without slipping

1.4. 3D Surface Plotter

3D surface plotter

2. Gravitation

2.1. Basic Solar System

solar_system

2.2.1. Randomized N-Body Simulations (collisionless)

n body sim

This version (2.2.2.) has the initial conditions that led to the picture above

This simulation can smoothly support up to 100 bodies on my computer, but enabling the trails behind each particle limits it to 4-6 bodies. I leave trails on in spite of this because the resutls look cooler and more patterns are observable. Once I implement collisions, I will probably disable trails.

2.3. Spaghettification

spaghettification

3. Electricity and Magnetism

3.1. Rutherford Scattering

rutherford scattering

The Geiger–Marsden experiments (also called the Rutherford gold foil experiment) were a landmark series of experiments by which scientists learned that every atom has a nucleus where all of its positive charge and most of its mass is concentrated. They deduced this after measuring how an alpha particle beam is scattered when it strikes a thin metal foil. (Source)

Source: https://flexbooks.ck12.org/cbook/ck-12-chemistry-flexbook-2.0/section/4.14/primary/lesson/rutherfords-atomic-model-chem

A fun little quote from Rutherford himself:

It was quite the most incredible event that has ever happened to me in my life. It was almost as incredible as if you fired a 15-inch shell at a piece of tissue paper and it came back and hit you.

3.2. Magnetic Vector Field

biot savart


Future Project Ideas

  • Account for collisions in Project 2.2. (N-Body Simulations) to prevent infinite gravitational force when bodies are extremely close
  • 3D game of life inspired by this video
  • Model a piece of rope with vpython springs

About

Visualizing physical systems with python. Click on a picture to run!

Topics

Resources

Stars

Watchers

Forks