Example Problem 1

Imagine a hemispherical interface, with a radius of curvature of radius 5.00 cm, separating two media: air on the left, water on the right. A 3.00 cm tall toad is on the central axis, in air, facing the convex interface and 30.0 cm from its vertex. Where in the water will the toad be imaged? How big will it appear to a fish in the water?

We will need 3 matrices :
    1) A translation matrix from the input plane to the hemispherical interface.
    2) A refraction matrix through the convex interface, from the air to the water.
    3) A translation matrix from the hemispherical interface to the output plane.

First Matrix, (Subscript[M, 1]): Translation Matrix
 (Subscript[L, 1])=(Subscript[x, 1])

Second Matrix, (Subscript[M, 2]): Refraction Matrix
(Subscript[n, 1])=1.00, (Subscript[n, 2])=4/3, (Subscript[R, 1])=+5.0 cm

Third Matrix, (Subscript[M, 3]): Translation Matrix
 (Subscript[L, 2])=(Subscript[x, 2])

n1=1;n2=(4/3);

R1=5;

L1=x1;L2=x2

M1=(({{1, L1}, {0, 1}}));M2=(({{1, 0}, {(1/R1)((n1/n2)-1), (n1/n2)}}));M3=(({{1, L2}, {0, 1}}));

Calculate the system matrix, M, by multiplying the 3 matrices together in reverse order.
M=(Subscript[M, 3])•(Subscript[M, 2])•(Subscript[M, 1])
(remember to use . (period) when multiplying matrices instead of * (asterisk))

TraditionalForm[{MatrixForm[M3],MatrixForm[M2],MatrixForm[M1]}]

TraditionalForm[Simplify[MatrixForm[M=M3.M2.M1]]]

For convenience, let's assign A, B, C,& D to each matrix element.
(C & D are protected symbols in Mathematica, so we'll have to use lower case letters).
Also, find the ratio of the input and output indices of refraction by calculating the determinate of the matrix M.

a=M[[1,1]];b=M[[1,2]];c=M[[2,1]];d=M[[2,2]];nR=Det[M]

Find the first system focal point by setting D=0 and solving for (Subscript[x, 1]).
Find the second system focal point by setting A=0 and solving for (Subscript[x, 2]).

{FocalPt1=Solve[d==0,x1],FocalPt2=Solve[a==0,x2]}

Find the image location for an object at 30 cm by setting (Subscript[x, 1])=30, B=0, and solving for (Subscript[x, 2]).

x1=30;ImageLoc=Solve[b==0,x2]

Find the magnification by evaluating A with (Subscript[x, 2])=ImageLoc.

a/.ImageLoc

Clear the values for (Subscript[x, 1]) and (Subscript[x, 2]) in case we want to make some additional calculations.

Clear[x1,x2]