An interactive Projectile Motion Simulator built using Python and Streamlit.
Compare two projectiles on Earth, Moon, or Mars, visualize their trajectories, and save results as images or CSV files.
This app demonstrates projectile motion in different gravitational fields.
You can:
- Set velocity and angle of projection
- Choose planetary gravity (Earth / Moon / Mars)
- Visualize and compare both projectile paths
- Save the plot as PNG or export data as CSV
- Python 3
- Streamlit — for interactive web UI
- NumPy — for mathematical calculations
- Matplotlib — for plotting trajectories
- Pandas — for saving results as tables
-Projectile-Motion-Simulator/
- │
- ├── app.py # Streamlit app (main interactive version)
- ├── basic_projectile.py # Command-line version
- ├── requirements.txt # Dependencies list
- ├── README.md # Project documentation
- └── .gitignore # Ignore unnecessary files
The simulator uses standard projectile motion formulas:
[ T = \frac{2u \sin(\theta)}{g} ] [ R = \frac{u^2 \sin(2\theta)}{g} ] [ y = x \tan(\theta) - \frac{g x^2}{2u^2 \cos^2(\theta)} ]
Where:
u→ Initial velocity (m/s)θ→ Launch angle (degrees)g→ Acceleration due to gravity (m/s²)
| Button | Description |
|---|---|
| 💾 Save as Image (PNG) | Saves the current plot as projectile_plot.png |
| 📊 Save as CSV | Exports projectile data to projectile_data.csv |
| Planet | Gravity (m/s²) |
|---|---|
| Earth | 9.8 |
| Moon | 1.62 |
| Mars | 3.71 |
| Projectile | Velocity (m/s) | Angle (°) | Time of Flight (s) | Range (m) |
|---|---|---|---|---|
| Projectile 1 | 50 | 45 | 7.21 | 255.10 |
| Projectile 2 | 70 | 60 | 12.38 | 428.40 |
Rajath S
Built as a physics + Python visualization project to simulate real-time projectile motion using Streamlit.
Feel free to fork the repository, improve the UI, or add new features like:
- Air resistance simulation
- 3D trajectory plots
- Planet comparison charts
Pull requests are always welcome!