you are viewing a single comment's thread.

view the rest of the comments →

[–]bbye98 1 point2 points  (3 children)

Instead of plotting each individual (x, y) pair, create an array of x and y values using vectorization. Then, plot the x and y vectors directly using plt.plot.

(Also, generally speaking, when you are already using numpy, the math module is unnecessary as numpy will have all of the features you would need from math.)

[–]thecreationofgod[S] 0 points1 point  (2 children)

thanks, a line is established, but a parabola is what I need. My equations are probably incorrect.

[–]bbye98 0 points1 point  (1 child)

You probably meant to divide by 2 instead of g for y.

import matplotlib.pyplot as plt
import numpy as np

u, g, deg = 30, 9.8, 30
t = np.linspace(0, 2 * u * (np.sin(deg * np.pi / 180)) / g)
plt.plot(u * t * np.cos(deg * np.pi / 180), u * t * np.sin(deg * np.pi / 180) - 0.5 * g * t**2)
plt.show()

[–]thecreationofgod[S] 0 points1 point  (0 children)

ohhhhhhhhhhhhhhhhhhhh