Skip to content

jynx0405/Projectile-Motion-Simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🎯 Projectile Motion Simulator

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.


🧩 Project Overview

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

🛠️ Tech Stack

  • Python 3
  • Streamlit — for interactive web UI
  • NumPy — for mathematical calculations
  • Matplotlib — for plotting trajectories
  • Pandas — for saving results as tables

📁 Project Structure

-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

🧠 Physics Concepts Used

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²)

💾 Output Options

Button Description
💾 Save as Image (PNG) Saves the current plot as projectile_plot.png
📊 Save as CSV Exports projectile data to projectile_data.csv

🌍 Gravity Values

Planet Gravity (m/s²)
Earth 9.8
Moon 1.62
Mars 3.71

📊 Example Output

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

🧑‍💻 Author

Rajath S
Built as a physics + Python visualization project to simulate real-time projectile motion using Streamlit.


⭐ Contribute

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!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages