SharedNew Projects and Problems / Circle inner reflections.ipynbOpen in CoCalc
Author: Peter Francis

Inner Cirlce Reflections\text{\Huge Inner Cirlce 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)
plot(11*np.pi/21,100)