n21 =

ControlCircunferencia = Point(Ray[(0, 0), Vector[(1, 0)]])
A = Intersect(xAxis, yAxis)
c = Circle(A, ControlCircunferencia)
l = Intersect(c, xAxis, 1)
P = Point(Ray[l, Vector[(-1, 0)]])
f, g = Tangent(P, c)
C = Intersect(c, g)
I' = Rotate(l, 360° - (1 / 4 * Angle[C, A, l]), A)
e = CircleArc(A, I', l)
d: e
o = Point(d)
h = Line(P, o)
o' = Intersect(c, h, 2)
n21 = 1.73 (slider from 1 to 3, step 0.01)
i = Line(A, o')
j = Line(A, o)
B' = Mirror(A, o')
B'_1 = Mirror(A, o)
k = Segment(o, o')
α = Angle(k, i)
β: asind((n21 * sin(α)))
O_1 = Rotate(B', 360° - β, o')
O_2 = Rotate(B'_1, β, o)
m = Mirror(l, Line[o, A])
D, E, m' = Refracciones(xAxis, yAxis, c, m, P, n21)
l_2 = Line(o', O_1)
p = Segment(m, m')
r = Line(m', E)
J = Intersect(r, xAxis)
K = Intersect(l_2, xAxis)
s = Segment(o', K)
t = Segment(m', J)
n = Mirror(o, Line[A, m])
q = Mirror(m, Line[A, n])
L, M, n' = Refracciones(xAxis, yAxis, c, n, P, n21)
a = Line(O_2, o)
b = Line(D, m)
o'' = Intersect(a, xAxis)
m'' = Intersect(b, xAxis)
f_1 = Segment(o, o'')
g_1 = Segment(m'', m)
h_1 = Line(L, n)
i_1 = Line(n', M)
j_1 = Segment(n, n')
n'' = Intersect(h_1, xAxis)
R = Intersect(i_1, xAxis)
k_1 = Segment(n'', n)
l_1 = Segment(R, n')
S, T, q' = Refracciones(xAxis, yAxis, c, q, P, n21)
m_1 = Segment(q, q')
n_1 = Line(q', T)
p_1 = Line(S, q)
q'' = Intersect(p_1, xAxis)
W = Intersect(n_1, xAxis)
q_1 = Segment(q', W)
r_1 = Segment(q, q'')
U' = Mirror(q', q')
W' = Mirror(W, q')
s_1 = Segment(U', W')
R' = Mirror(R, n')
N' = Mirror(n', n')
t_1 = Segment(R', N')
F' = Mirror(m', m')
J' = Mirror(J, m')
t' = Segment(F', J')
O'' = Mirror(o', o')
K' = Mirror(K, o')
s' = Segment(O'', K')
a_1 = Segment(P, o)
b_1 = Segment(P, m)
c_1 = Segment(P, n)
d_1 = Segment(P, q)
v = Max({x(W), x(R), x(l), x(K)})
e_1 = Ray(P, A)
CasillaDeEntrada1 = Textfield(n21)

Tool: Refracciones
Input: xAxis, yAxis, c, O, P, n21
Output: O_2, O_1, O'

B = Intersect(xAxis, yAxis)
I = Intersect(c, xAxis, 1)
f, g = Tangent(P, c)
C = Intersect(c, g)
d = CircleArc(B, C, I)
h = Line(P, O)
O' = Intersect(c, h, 2)
i = Line(B, O')
B' = Mirror(B, O')
B'_1 = Mirror(B, O)
k = Segment(O, O')
α = Angle(k, i)
β: asind((n21 * sin(α)))
O_1 = Rotate(B', 360° - β, O')
O_2 = Rotate(B'_1, β, O)