CoCalc Public FilesNew Projects and Problems / Circle inner reflections.ipynbOpen in with one click!
Author: Peter Francis

Inner Cirlce Reflections\text{\Huge Inner Cirlce Reflections}

In [1]:
import numpy as np import matplotlib.pyplot as plt from numpy import pi
In [2]:
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)
In [3]:
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));
In [4]:
plot(1,100) plot(pi/6,100) plot(2*pi/5,100)
In [5]:
In [ ]: