Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import math;
- g = 9.8
- angle_in_rads = math.radians(45);
- def solve_quadratic_equation(a, b, c):
- return (-b-math.sqrt(b*b-4*a*c)) / 2*a;
- def xfrange(start, stop, step):
- while start < stop:
- yield start
- start += step
- def Sy(t, V0, angle):
- sin_alpha = math.sin(math.radians(angle));
- return V0*sin_alpha*t - (g * t * t) / 2;
- def Sx(t, V0, angle):
- cos_alpha = math.cos(math.radians(angle));
- return V0*cos_alpha*t;
- def V0FromSx(Sx_value, t):
- return Sx_value / math.cos(math.radians(45)) * t;
- max_distance = 100;
- V0 = (max_distance * g ) / ( 2 * math.sin(angle_in_rads) );
- pointslist_x = []
- pointslist_y = []
- for time in xfrange(0, 10, 0.1):
- print(time);
- pointslist_x.append(Sx(time, V0, 45));
- pointslist_y.append(Sy(time, V0, 45));
- plt.plot(pointslist_x, pointslist_y)
- plt.ylabel('some numbers')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement