R1

R2

R3

n21 =

Circunferencia = 0.89 (slider from 0 to Distance[E, A], step 0.01)
S = (-4, 0)
A = Point(Ray[(0, 0.5), Vector[(0, 1)]])
C = Intersect(xAxis, yAxis)
E = Point(Segment[C, S])
r = Distance(A, E)
w(x, y) = x^(2) + (y - y(A))^(2) ≤ r^(2)
ControlCircunferencia = PointIn(w)
n21 = 1.62 (slider from 1 to 2.5, step 0.01)
B = Mirror(E, yAxis)
k = Ray(C, Vector[(0, -1)])
H = Point(k)
I = Point(Ray[H, Vector[(-1, 0)]])
b = Line(I, A)
c = Circle(A, Circunferencia)
j = Line(I, B)
B_1 = Intersect(c, j, 1)
A' = Mirror(A, B_1)
i_3 = Angle(I, B_1, A')
r_3: asind((1 / n21 * sin(i_3)))
A'_1 = Rotate(A, (-r_3), B_1)
l = Line(B_1, A'_1)
D = Intersect(c, l, 2)
A'_2 = Mirror(A, D)
F = Rotate(A'_2, i_3, D)
p = Line(D, F)
f = Line(H, xAxis)
g = Line(A, xAxis)
h = Line(I, E)
i = Line(I, C)
m = Segment(I, B_1)
n = Segment(B_1, D)
N = Intersect(b, p)
q = Segment(N, D)
J = Intersect(c, i, 1)
A'_3 = Mirror(A, J)
i_2 = Angle(I, J, A'_3)
r_2: asind((1 / n21 * sin(i_2)))
A'_4 = Rotate(A, (-r_2), J)
r_4 = Line(J, A'_4)
s = Segment(I, J)
K_1 = Intersect(c, r_4, 2)
t = Segment(J, K_1)
A'_5 = Mirror(A, K_1)
L_1 = Rotate(A'_5, i_2, K_1)
a = Line(K_1, L_1)
M_1 = Rotate(A'_5, i_2, K_1)
d = Line(K_1, M_1)
L = Intersect(d, b)
e = Segment(L, K_1)
O = Intersect(c, h, 1)
A'_6 = Mirror(A, O)
i_1 = Angle(I, O, A'_6)
f_1 = Segment(I, O)
r_1: asind((1 / n21 * sin(i_1)))
A'_7 = Rotate(A, (-r_1), O)
g_1 = Line(O, A'_7)
P = Intersect(c, g_1, 2)
h_1 = Segment(P, O)
A'_8 = Mirror(A, P)
Q = Rotate(A'_8, i_1, P)
j_1 = Line(P, Q)
M = Intersect(j_1, b)
k_1 = Segment(M, P)
S' = Mirror(S, yAxis)
l_1 = Segment(S, E)
m_1 = Segment(B, S')
n_1 = Segment(I, H)
p_1 = Ray(I, A)
N' = Mirror(N, D)
D' = Mirror(D, D)
q' = Segment(N', D')
L' = Mirror(L, K_1)
K' = Mirror(K_1, K_1)
e' = Segment(L', K')
M' = Mirror(M, P)
P' = Mirror(P, P)
q_1 = Segment(M', P')
o = false
u = false
v = false
CasillaDeEntrada1 = Textfield(n21)
K: (0, (3 * y(A)))
s_1 = Segment(H, K)