![]() |
Pan# is a language of functional images. An image is represented as a function from points in the plane onto colors. For example, the following Pan# program described a parabola: picture (x,y) = if x < y*y then white else black When executed, this yields the following picture:
Although this isn't particularly stunning, it can be created in a single line of code. More interesting is the case in which the image interacts with the student. To visualize a more general quadratic we use the following program: a <- slider "a" (-3, 3) 1 This creates an interactive image as follows:
As the sliders that define the equation move, the image is rapidly updated. This allows students to get a feel for how the parameters relate to the parabola and understand the "flow" of the equation as parameters change. For example, this example can be used to discover the following properties of this equation:
We can use color to show how each of the parameters contributes to the equation. Black is the composite curve while blue is the constant part, red is the linear part, and yellow is the quadratic part.
A more creative way to visualize a function is to use it to warp a picture. The following program uses a parabola (again) to warp a image. a <- slider "a" (-0.1, 0.1) 0.1 The last three lines import a picture from a .jpeg file (pic) and define a point to point mapping that distorts the picture. This mapping uses the parabola to scale the y value, warping each line of constant y to a parabola. Functional programmers will recognize the use of the "." operator for function composition. The following picture of Thomas Edison is warped using this program: Although image warping may seem somewhat frivolous, it can be used to explore many basic mathematical concepts, including domain and range, slope, continuity, and singularities. It is also a good way to understand 2-D coordinate systems and transformations. The Pan# distribution contains many examples of Pan# programs that illustrate general mathematical principals in new and interactive ways. By far the best way to understand the capabilities of this software is to install it and run the many demos that are packaged with the system. There are also a number of powerpoint presentations that accompany these examples. |
Computer Languages for Secondary Education