Friday, 18 July 2014

Physics with Python

Today I am going to built a class in Python to simulate a famous kind of motion: projectile motion!

I said a "Class" because while trying to find something to build a class on, I noticed that a projectile could fit perfectly. In fact, a projectile, or any other object which when launched, moves along a curved path under the action of gravity only, has some characteristics: speed, mass, etc...
Displaying all these characteristics through a class can be at the same time both fun and useful for practicing with classes.

The basic assumptions of this kind of motion are the following:
- There is no air friction
- The only significant force which acts on the projectile is gravity

Additional assumptions:
- Projectile starts at y = 0 (from ground)

If you'd like to gather more information on this kind of motion, check out wikipedia:

Here are the results:

Here is a video I made with the instance p and the last method:

It would be fun to implement air friction and then compare the data.

If you find incorrect physics terms please let me know or comment, I might not fully remember my physics classes!! :)

No comments:

Post a Comment