Click on the image to see its parameters.

Tutorial: Fresnel Integral Coloring

Text and Images © 2011 Kerry Mitchell

Introduction

The Fresnel integrals show up in physics (particularly, optics), and are interesting in part because they look simple (considering how involved calculus can be), but aren't easy to evaluate. When taken together, their graphs create the Cornu spiral:

The points on the curve come from evaluating these equations:


Although the equations don't have simple analytical solutions, they can be solved numerically, and that's what this coloring does. More precisely, it draws the graphs that result from evaluating the equations numerically.

Background

The process of evaluating these equations is called integration. Ideally, this results in formulas. However, this usually isn't possible, so computers are often used to get answers as numbers. This process, numerical integration, was one of the first applications of digital computers and can be extremely tricky. That trickiness is what makes this coloring work, along with some generalizations of the functions being integrated.

The integrand for the x equation is cos(π/2 t2) and is sin(π/2 t2) for the y equation. For this coloring, you can vary the frequencies and exponents independently to any real value.

By default, the frequencies are π/2 for both equations. Changing the frequency alters the alignment of the sine and cosine functions, giving the graphs a very different feel. (Click on the images to see the parameters.)

Red: sine 5% higher, cosine 5% lower
Green: sine default, cosine default
Blue: sine 5% lower, cosine 5% higher
Red: sine twice default, cosine default
Blue: sine default, cosine twice default

A similar thing happens when changing the exponents, which are both set to 2 by default:


Red: sine 2.02, cosine 1.98
Green: sine 2, cosine 2
Blue: sine 1.98, cosine 2.02

In the middle near the bottom, there's black spiral that winds around a point. That shows how all three lines (in this example) start out similar--their graphs lie on top of each other. However, fairly quickly, the curves diverge and each takes its own path.

In the integrals, the upper limit is θ. This value acts describes how long the curve is. In the Cornu spiral graph above, the curve begins at the green dot and ends up wrapping around the final point (the white hole). Increasing θ would make the graph longer and it would fill in the hole even more. This graph is composed of many segments (1024, to be exact). Using more segments makes the curve smoother, at the expense of memory and calculation time.

The curve's extent (θ) and the number of segments are set together and indirectly. It turns out that if you were to set θ to get a pleasing shape and then change the number of segments to make the curve smoother, then basic shape of the graph would change. However, changing both simultaneously can allow you to maintain the shape. This is done through a base and a multiple. Given both, then:

In the figure below, all three curves have the same base (41) and different multiples. The blue curve has the largest multiple and extends furthest out into the space. With the smallest multiple, the red curve is most confined. In between, in both multiple and extent, is the green curve.


Red: base 41, multiple 4
Green: base 41, multiple 5
Blue: base 41, multiple 6

To keep the same basic shape and make the graph smoother, keep the multiple the same and increase the base by a multiple of the square of the multiple. For example, in this image, all three curves have a multiple of 3 (the default) and they all have the same basic shape. How do they differ?

Click on the image to download the parameters. Play with the mulitiplier and base values to see how they change (or don't change) the image. Notes:

  1. The "change the base by a multiple of the multiple squared" trick works when the frequencies are both set to 1 and the powers both set to 2 (the default settings). It may work with other settings, but you get to find that out on your own.
  2. In this image, I've hidden parts of the green curve and blue curves to show the graphs more clearly. You can control how much of the curve is shown (without changing it) by adjusting the "first line" and "last line" parameters. Set them both to 0 to show the entire curve.
Integration is often thought of as adding up a lot of areas (yes, I know that this is a gross oversimplification, but just go with it). There are many ways to do that, and changing the integration method will change the graph you get with this coloring. Three methods are offered: You choose how much of each method you want to employ by setting its weight. Here are several examples, each using the default frequencies, powers, multiples, and bases. In the left image, the red curve is the rectangular rule, green is trapezoidal, and blue is Simpson's rule. In the right image, the three methods are combined in differing amounts.

Red: rect. 1, trap. 0, Simp. 0
Green: rect. 0, trap. 1, Simp. 0
Blue: rect. 0, trap. 0, Simp. 1
Red: rect. 1, trap. 1, Simp. 1
Green: rect. 1, trap. -1, Simp. (0, 1)
Blue: rect. 3, trap. -2, Simp. (1, 2)

To manage the weights:

Parameters

The parameters are in three groups: those for the functions being integrated, those for the integration method, and drawing parameters. Where there is "(hint)" next to the parameter name (in UF, not here), that indicates that some small modicum of help is available (click on UF's "?" icon and then click in the entry area for that parameter to see the hint.)

Function Parameters

Integration Parameters

Remember that, while any individual weight can be 0, the total of the three weights added together cannot be 0.

Drawing Parameters

Hints

I consider this to be a special-purpose coloring, and not necessarily conducive to general fractaling. You are, of course, free to use this coloring however you’d like. However, these hints may help your explorations be more productive.

Back to Tutorials page
Up to my home page