Lab 04 - Jay1337/computational_physics GitHub Wiki
Goals of Lab:
In this lab we had the goal of using the Euler method so that we could plot the x and y position for an object in projectile motion. Specifically here we modeled an object in projectile motion with air resistance, and instead of using a final max time to stop the calculation due to the inclusion of air resistance we needed to find a different way to stop our calculations. We wanted to find how the Euler method would work with inclusion of air resistance in our motion, and how different angles change the motion of our projectile. We needed to plot a graph to go through these ranges so that it is easier/simpler to see the difference in range for different angles of our projectile.
Overview:
In this lab our main objective is figuring out x and y positions for an object in projectile motion, and the way we do this is by using a function with Euler method equation that looks for position. This object is in air resistance along with projectile motion though so a force of gravity is not the only force to be looking at as our drag force must be accounted for as well. These forces in general our important to know the parameters for due to the fact that in our Euler equation for position x_i = x_i-1 + v_i-1 * dt and in order to find position you need the Euler equation for velocity which is v_i = v_i-1 + a_i-1 *dt. This means that we need equations for acceleration in the x and y direction which is where our forces and the parameters that go into our forces come into play. This is why before we make our function for Euler equation for position we first make a function for acceleration in x direction and a function for acceleration in y direction. After defining these functions for acceleration so that we can call them later on in our function for position, comes figuring out how we are gonna stop the calculation. We know that the projectile will hit the ground at y = 0 so stopping the calculation at y = 0 is our best bet. In order to do so we first set our initial conditions and parameters then wrote a while loop that states while y_i-1>=0 so that we can continue getting values in our list up until y hits 0.
After plotting the positions we changed the starting angle by making a loop to run through different values of theta, and found that our range changes as our angle changes meaning the range is dependent on the initial angle. With a larger angle it seems that we get a steeper trajectory.
When it comes to the range for with air resistance and without air resistance it seems as though the position values for without air resistance are much bigger compared to with air resistance, along with the fact that the angle makes the graph vary way more than when it had air resistance. The graphs now without air resistance seem to be steeper, and through this we can see how much air resistance affects an objects position. With air resistance or range gets reduced and a trajectory is way different than what it would be without air resistance. The angle of which we launch also can be seen to have great effect on an object's range and how high it will end up going.