https://github.com/burnycoder/harmonic-oscillator
Interactive web-based harmonic oscillator visualization with adjustable parameters and real-time plots in Numpy and Flask
https://github.com/burnycoder/harmonic-oscillator
Last synced: about 2 months ago
JSON representation
Interactive web-based harmonic oscillator visualization with adjustable parameters and real-time plots in Numpy and Flask
- Host: GitHub
- URL: https://github.com/burnycoder/harmonic-oscillator
- Owner: BurnyCoder
- Created: 2025-03-09T15:10:40.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-09T15:17:39.000Z (over 1 year ago)
- Last Synced: 2025-03-09T16:23:31.333Z (over 1 year ago)
- Language: HTML
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Interactive Harmonic Oscillator Visualization
A web-based interactive harmonic oscillator visualization tool that allows users to explore the dynamics of a simple harmonic oscillator. This tool includes mathematical equations, animated visualizations, and interactive plots.

## Features
- Interactive controls to adjust:
- Mass
- Spring constant
- Damping coefficient
- Initial position
- Initial velocity
- Time span
- Real-time animation of the oscillating mass-spring system
- Plots of position, velocity, and energy components
- Mathematical equations explaining the harmonic oscillator physics
- Support for undamped, underdamped, critically damped, and overdamped systems
## Requirements
- Python 3.6+
- Flask
- NumPy
- Plotly
- Modern web browser with JavaScript enabled
## Installation
1. Clone this repository
2. Install the required packages:
```
pip install -r requirements.txt
```
## Usage
1. Start the Flask server:
```
python app.py
```
2. Open your web browser and navigate to `http://localhost:5000`
3. Use the interactive controls to adjust parameters and observe the changes in the system behavior
## Physics Background
The simple harmonic oscillator is a fundamental model in physics that describes oscillatory motion where a restoring force is proportional to the displacement from equilibrium. The core equation of motion is:
```
m(d²x/dt²) + b(dx/dt) + kx = 0
```
Where:
- m is the mass
- b is the damping coefficient
- k is the spring constant
- x is the displacement from equilibrium
The behavior of the system depends on the damping ratio (ζ = b/(2√(km))):
- ζ = 0: Undamped oscillation
- 0 < ζ < 1: Underdamped oscillation
- ζ = 1: Critically damped
- ζ > 1: Overdamped
## License
MIT