Jon Rosario's Journal.
Simulating a basic Mass-Spring System using VPython
March 30, 2021
Hello! Today, I decided to explore modeling and simulation within Python. One useful module I found was VPython, developed by glowscript, which allows me to create basic physics simulations and display them.
My code is based off of basic dynamics and kinematics: vector form of Newton's 2nd Law, and the relationship between acceleration, velocity, and position mostly. My algorithm runs a loop until paused with given user-inputed values for k (spring constant), x_0 (initial position of spring), and m (mass) and recalculates the new position 1/dt times per second.
That's all for today. Thanks for reading!