Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: Peter's Files
Views: 477
Visibility: Unlisted (only visible to those who know the link)
Kernel: Python 3 (Ubuntu Linux)
import numpy as np import matplotlib.pyplot as plt
def generate(initial_rad_position, deflection, number_of_points): XPoints = [0]*number_of_points YPoints = [0]*number_of_points angle = initial_rad_position for i in range(number_of_points): XPoints[i] = np.cos(angle) YPoints[i] = np.sin(angle) angle = 2 * deflection + angle return (XPoints, YPoints)
fig, ax = plt.subplots(figsize=(10,10)) ax.set_aspect('equal') ax.autoscale() x=np.linspace(-1,1,500) y_1 = np.sqrt(1-x**2) y_2 = -np.sqrt(1-x**2) ax.plot(x,y_1); ax.plot(x,y_2); ax.plot(*generate(0,np.pi/7,100));
Image in a Jupyter notebook