Raspberry Pi is a great tool for teaching. Its affordable price makes it appealing for students and teachers that can make interesting "experiments" without spending a fortune.

The understanding of optics requires lot of geometry, but equations are deeply understood only by a small number of students. Drawings may help, but making them requires some ability and precision. Needless to say, in most cases, the result is static and, in order to understand what happens in different conditions, require to realise many drawings.

A very interesting alternative is using an application called **GeoGebra** that can be downloaded for free from the Internet. Interesting enough, GeoGebra runs on Raspberry Pi. Every student, then, can do his/her own experiment with optics using GeoGebra. See this post to learn how to install it (quite simple, in fact; the only tricky part being installing the Java virtual machine). In short, download the arm version of the Java VM from http://jdk8.java.net/fxarmpreview/index.html, then issue the following commands in a terminal

sudo apt-get update sudo apt-get install geogebra sudo apt-get install geogebra-gnome mkdir -p /opt sudo tar zxvf (name of package) -C /opt rm (name of package) sudo /opt/jdk1.8.0/bin/java -version export JAVACMD=/opt/jdk1.8.0/bin/java geogebra

In Roma, we realised a very successful exhibition about light and its scientific applications for the International Year of the Light, in which, besides other experiments, we put few interactive stations made of a Raspberry Pi running GeoGebra, a screen and a mouse. One of those stations, for example, is intended to show what happens to a light ray when passing from a medium to another with different refractive index.

You can see a copy of it at the following address: https://tube.geogebra.org/material/simple/id/1395913. I firmly believe that, if you use tools on the web (like the one I provided above) you can learn something, but if you make it by your own, you learn much much more. So, I strongly suggest you make your own simulation: even if not so nice, it will be much more useful!

How can you do it? Very simple, in fact: just follow the steps below for a very basic simulation, then help yourself to give it a better look. In the following I'm assuming that in your preferences you set the units of the angles as radians.

- Draw a line
*a*parallel to the x-axis. Just select the appropriate tool on GeoGebra, then select the x-axis and move the pointer to draw a line parallel to it. This action selects a point*A*on such a line.

- Locate a random point
*B*in the plane above the line. This will be the light source and it is supposed to be in the air, whose refractive index is 1. Draw a vector from*B*to*A*.

- Selects the perpendicular line tool and draw a line perpendicular to the first one passing through point
*A*. Locate a point*C*on it.

- Using the angle tool, selects, in turn, points
*B*,*A*and*C*to compute the incident angle`α`.

- Now, a little algebra is needed. In order to compute the refraction angle you need to use the Snell's Law:

`n`_{1}sin(`α`)=`n`_{2}sin(` γ `)

Here n_{1}=1 is the refraction index of the starting medium, while n_{2} is the one for the medium supposed to be under the first line. Assume n_{2}=1.33. You can then compute the refraction angle ` γ ` as the arcsin of sin(

`α`)/1.33. The angle made by the refracted light with the x-axis is the a right angle minus the latter, hence you can compute the angle

`β`=π2 −`γ`

You can just type that formula in the input box at the bottom of the GeoGebra window. Greek letters can be selected from the tool on the right of the input box, while π can be just written as pi. The tangent of such an angle is the slope of the line parallel to the refracted beam, that you can compute just typing

m=tan( `β` )

There are infinite lines with that slope: the one passing through point *A* has intercept given by

q=x(A)-m*y(A)

where x(A) and y(A) returns the x- and y-coordinate of point A. You can, then, just type the equation of the line whose slope is m and whose intercept is q as

y=m*x+q.

- Select, now, the intersect tool and locate the point
*D*where the x-axis intersects the latter line, and draw a vector from point*A*to that point.

- You can now select the line used to locate point D to make it invisible. You can now move the light source
*B*around: the incident angle changes, as well as the refraction one, hence the refracted beam, represented by the latter vector moves accordingly.

You can, of course, refine the simulation: the case in which the starting medium has a higher refractive index with respect to the second one is not well simulated by the above tool. With GeoGebra you can specify conditions for the visibility of objects, so you can add an alternative simulation to be shown when those conditions occur. You can learn more about that either reading the GeoGebra user manual or stealing what I made in the simulation cited above.

## Top Comments

Nice post.