Draw a parabola (computer python)
From wikiluntti
Introduction
The script is used to plot and test the code for drawing the parabola using a robot
import matplotlib.pyplot as plt
import math
a = -0.1
x,y = [], []
for i in range(-5,1):
y1 = i
y0 = i-1
Dy = y1-y0
Dx = math.sqrt(y1/a) - math.sqrt(y0/a)
alpha = math.atan(Dx/Dy)/3.14159*180 #In degrees
l = math.sqrt(Dy**2 + Dx**2)
print( alpha, l )
x.append( math.sqrt(y1/a) )
y.append( y1 )
# Plot the true parabola using Numpy.
from numpy import *
xx=linspace(0,x[1],5000)
yy=a*xx**2
plt.plot(x,y, 'o-')
plt.plot(xx,yy)