Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: Peter's Files
Views: 3893
Visibility: Unlisted (only visible to those who know the link)
Image: ubuntu1804
Kernel: Python 3 (system-wide)
Inner Circle Reflections\text{\Huge Inner Circle Reflections}
import numpy as np import matplotlib.pyplot as plt from numpy import pi
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)
def plot(angle,bounces): fig, ax = plt.subplots(figsize=(7,7)) 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,'k'); ax.plot(x,y_2,'k'); ax.plot(*generate(0,angle,bounces));
plot(1,100) plot(pi/6,100) plot(2*pi/5,100)
Image in a Jupyter notebookImage in a Jupyter notebookImage in a Jupyter notebook
plot(11*np.pi/21,100)
Image in a Jupyter notebook