Menu

Tree [a8e112] default tip /
 History

Read Only access


File Date Author Commit
 physicssim 2020-07-22 David H David H [7417a3] Fix minor typo in comment
 rust 2022-05-10 David H David H [a8e112] Fix several animation control glitches
 sympy_bugs 2016-04-10 David Handy David Handy [b7b8de] Got two-mass three-spring system working.
 .gitignore 2022-04-27 David H David H [6ac991] Add pkg to ignore files for WASM
 .hgignore 2022-04-27 David H David H [6ac991] Add pkg to ignore files for WASM
 Accelerometer.ipynb 2020-04-08 David H David H [075d50] Start acclerometer analysis
 LICENSE.txt 2016-01-15 David Handy David Handy [1b94ab] README and LICENSE files added
 README.rst 2017-08-01 David Handy David Handy [8193e4] Fix double period
 calc_acceleration.py 2020-10-19 David H David H [57bbe8] Allow modifying distance range
 damped-oscillation.ipynb 2019-08-21 David H David H [132602] Updates to Python version, Jupyter version
 demo-are-we-there-yet.ipynb 2020-04-08 David H David H [ebb71d] minor updates
 demo-signal-gen.ipynb 2020-04-08 David H David H [ebb71d] minor updates
 force-friction-problem-0.ipynb 2022-04-27 David H David H [4dbbd2] Updates to explanatory text, Python version
 force-friction-problem-1.ipynb 2022-04-27 David H David H [4dbbd2] Updates to explanatory text, Python version
 forcefield.ipynb 2019-08-21 David H David H [132602] Updates to Python version, Jupyter version
 install-fedora.rst 2018-11-10 David H David H [6ae1b8] Instructions for installing on Fedora Linux
 install-ubuntu.rst 2017-07-31 David Handy David Handy [b0591f] Improve README, install instructions, and progr...
 integrate-rational-polynomial.ipynb 2019-08-22 David H David H [3dbac7] Solution to math problem shared on Facebook
 orbitsim 2016-05-14 David Handy David Handy [333c4e] Move simulation code to physicssim package.
 plot_weather_data.py 2017-11-07 David Handy David Handy [ebbf9e] Small tweaks
 rendersim 2016-05-14 David Handy David Handy [333c4e] Move simulation code to physicssim package.
 requirements.txt 2019-08-22 David H David H [6c1fd9] Fix cpif link in requirements.txt
 springmass 2016-05-14 David Handy David Handy [333c4e] Move simulation code to physicssim package.
 two-mass-three-spring.ipynb 2022-04-27 David H David H [4dbbd2] Updates to explanatory text, Python version
 two-mass-three-spring.svg 2016-04-10 David Handy David Handy [b7b8de] Got two-mass three-spring system working.

Read Me

Physical Science Simulations

This is an open source repository of software and data I created for demonstrating and teaching principles of Physical Science.

See the LICENSE.txt file for terms of use. There is NO WARRANTY. These files are shared in the hope that someone finds this helpful.

Installation

This software has been developed on Linux using Python. Experienced developers can probably get it to work on other platforms.

First you either need to clone this repository using Mercurial or else download the files in this repository and extract them.

Next, see install-ubuntu.rst for instructions on how to prepare to run this software on Ubuntu Linux. (TL;DR for those familiar with Python: create a virtualenv, then pip install -r requirements.txt. But there are some C/C++ dependencies to apt-get install first.)

Running the Spring-Mass Simulations

I created a physics engine that simulates the motion of arbitrary masses connected to one another by ideal springs, with simple friction proportional to the speed of the masses. I then set up several scenarios that can be run from a simple text menu.

Some of these scenarios are designed to demonstrate wave propagation, reflection, and superposition. But other scenarios are just for fun and curiousity.

If you have difficulty running this software (or just want to see the results without the hassle), see my video of the stretch-rope scenario (800K).

After activating your virtual environment according to the installation instructions above, run this command in the root directory of this repository:

./springmass

It will print a text menu of simulation scenarios. Enter the name or number of the scenario and press Enter to start it. A graphical window will come up. Press the green start button in the upper-right corner of the window to run the scenario. Click the red stop button (visible when the scenario is running) to pause the scenario and "freeze" the motion. Click the green start button again to resume.

The first time you run this program, I suggest you run scenario #9 (transverse_wave). Then try #8 (stretch_rope). Enjoy!

Keeping Things Real

I made an effort to ensure that my physics engine is an accurate mathematical model based on Newton's laws of motion. As part of that effort I created some ipython notebooks with the relevant math. You can run these notebooks from the root of the repository clone using Jupyter Notebook, which was installed when you followed the installation instructions.

How to Run the Jupyter Notebooks

Run this command in the root of the repository clone:

jupyter notebook

It will pop up a new page in your web browser showing the contents of the repository. The .ipynb files are ipython notebooks; click on those to run them.

Try clicking on demo-signal-gen.ipynb. The notebook will open up in a new browser tab. In the menu at the top of the page select Cell -> Run All. Then scroll down till you see the graph of the damped oscillation. Click the play button and you can hear what it sounds like.

How to Produce HTML Files from Notebook Files

Run these commands:

jupyter nbconvert --to html forcefield.ipynb
jupyter nbconvert --to html force-friction-problem-0.ipynb
jupyter nbconvert --to html force-friction-problem-1.ipynb