Function Repository Resource:

MirrorManipulate

Source Notebook

Generate a graphic of a ray diagram in which the circular mirror parameters can be manipulated dynamically

Contributed by: Julián Laverde

ResourceFunction["MirrorManipulate"][]

returns a manipulable graphic of the ray diagram of a spherical mirror.

ResourceFunction["MirrorManipulate"][assoc]

returns a manipulable graphic of the ray diagram of a spherical mirror with the corresponding parameters in the Association assoc.

Details and Options

The available mirrors are convex and concave.
ResourceFunction["MirrorManipulate"] follows the sign convention for spherical mirrors from Hecht, Optics, Pearson, 2015:
Object distance (+) real object(-) virtual object
Focal length (+) converging mirror(-) diverging mirror
Image distance (+) real image(-) virtual image
Object size(+) erect object(-) inverted object
Image size(+) erect image(-) inverted image
Magnification (M)(+) erect image(-) inverted image
The linear magnification factor of the system is given by the equation , defined as the ratio of the size of the image compared to the size of the object.
ResourceFunction["MirrorManipulate"] uses the Gaussian mirror formula to calculate the image distance (si). This equation is only valid for the paraxial region of the mirror.
The arrow in the rays represents the direction of light travel and dotted lines the projection of the rays.
Real images and virtual images are represented by a thick-line arrow and a dotted-line arrow, respectively.
In ResourceFunction["MirrorManipulate"][assoc], the Association assoc can contain the following elements:
"Diameter"4mirror (half) diameter
"ObjectSize"0.5object initial size
"FocalLength""Diameter"mirror initial focal length
"ObjectDistance""FocalLength"object initial position
"ObjectDistance" can be a positive number or quantity of length.
"ObjectSize" can be a number in the range[-1,1].
"FocalLength" can be a positive or negative number or quantity of length.
Quantity inputs should have units of length. Results and values in sliders will be shown in the most common unit among the inputs.
ResourceFunction["MirrorManipulate"][] takes the options of Graphics and the following:
"RayColor"Automaticspecify the colors of the rays
"MirrorColor"Automaticspecify the color of the mirror
"ArrowColor"Automaticspecify the colors of the object and image arrows
"ShowEquations"Trueset the equations in the graphics object
"ObjectDistanceRange"Automaticspecify the range of "ObjectDistance"
"ObjectSizeRange"Automaticspecify the range of "ObjectSize"
"FocalLengthRange"Automaticspecify the range of "FocalLength"
The copy values button copies the current values of "ObjectDistance", "FocalLength", "ImageDistance" and "Magnification" to the clipboard as an Association.

Examples

Basic Examples (2) 

Launch MirrorManipulate, a Manipulate about mirrors:

In[1]:=
ResourceFunction["MirrorManipulate"][]
Out[1]=

Get the ray diagram for a set of specified initial values:

In[2]:=
ResourceFunction[
 "MirrorManipulate"][<|"FocalLength" -> 10, "Diameter" -> 5, "ObjectDistance" -> 4, "ObjectSize" -> 0.4|>]
Out[2]=

Scope (2) 

Get the ray diagram for a negative mirror:

In[3]:=
ResourceFunction[
 "MirrorManipulate"][<|"FocalLength" -> -19, "ObjectDistance" -> 20, "Diameter" -> 10|>]
Out[3]=

Use quantities to specify lengths:

In[4]:=
ResourceFunction[
 "MirrorManipulate"][<|"FocalLength" -> Quantity[-20, "Millimeters"], "ObjectDistance" -> Quantity[26, "Millimeters"], "Diameter" -> Quantity[10, "Millimeters"]|>]
Out[4]=

Options (7) 

LensManipulate takes the options of Graphics:

In[5]:=
ResourceFunction[
 "MirrorManipulate"][<|"FocalLength" -> 15, "Diameter" -> 10|>, Axes -> True, ImageSize -> Large]
Out[5]=

ShowEquations (1) 

Set "ShowEquations" to False:

In[6]:=
ResourceFunction["MirrorManipulate"][<|"FocalLength" -> -5|>, "ShowEquations" -> False]
Out[6]=

RayColor (1) 

Change the color of the rays:

In[7]:=
ResourceFunction[
 "MirrorManipulate"][<|"ObjectDistance" -> 20, "FocalLength" -> 11, "Diameter" -> 10|>, "RayColor" -> {Darker[Green], Blue, Orange}]
Out[7]=

ArrowColor (1) 

Change the color of the object and virtual arrows:

In[8]:=
ResourceFunction[
 "MirrorManipulate"][<|"FocalLength" -> 6, "Diameter" -> 5|>, "ArrowColor" -> {Gray, Blue}]
Out[8]=

MirrorColor (1) 

Specify the color of the mirror:

In[9]:=
ResourceFunction["MirrorManipulate"]["MirrorColor" -> {Blue}]
Out[9]=

ObjectDistanceRange (1) 

Specify the range of "ObjectDistance":

In[10]:=
ResourceFunction["MirrorManipulate"][<|"ObjectDistance" -> 18|>, "ObjectDistanceRange" -> {15, 20}]
Out[10]=

ObjectSizeRange (1) 

Specify the range of "ObjectSize":

In[11]:=
ResourceFunction["MirrorManipulate"]["ObjectSizeRange" -> {0.4, 0.6}]
Out[11]=

FocalLengthRange (1) 

Specify the range of "FocalLength":

In[12]:=
ResourceFunction[
 "MirrorManipulate"][<|"ObjectDistance" -> -5, "FocalLength" -> -8, "Diameter" -> 5|>, "FocalLengthRange" -> {-10, -5}]
Out[12]=

Publisher

WolframSpecialProjects

Version History

  • 1.2.0 – 12 September 2022
  • 1.1.0 – 02 June 2021
  • 1.0.0 – 17 March 2021

Source Metadata

Related Resources

License Information