Donut Toy

Donut Toy

[donut toy]
If you are a parent, a big brother, a big sister, or a toddler you probably recognize this Fisher-Price® product. This page describes how I made the donut toy graph. In particular, how did I get the donuts to have the rainbow colors? This is an example of mathematical modeling that does not require calculus.

The steps in the color are made possible by the floor function, floor(x), which is the greatest integer less than or equal to x. (For example, floor(3.2) = 3, floor(7) = 7, and floor(-3.2) = -4.) This floor function has just recently been added to DPGraph.

To begin with, I got out a ruler and measured the toy and found that the total height of the model is about 13 cm, and the width is about 6.2 cm. The coordinates used in DPGraph are measured in cm. The dividing lines between the colors are:


We want the color to be blue for all z between 0.0 and 3.0, green for all z between 3.0 and 5.8, etc. The heights zn have constant second difference, since the differences are 3.0, 2.8, 2.6, 2.4 and 2.2. It is well-known that quadratic functions have a constant second difference, and it's not too hard to show that zn = (31 n - n2)/10. (Hint: I set zn = 13/5 n + c n (5-n) and solved for c.) This can then be inverted to find n = 31/2 - sqrt(961/4 - 10 zn). The floor function then makes n = floor( 31/2 - sqrt(961/4 - 10 zn) ) equal to 0 for z between 0 and 3, equal to 1 for z between 3 and 5.8, etc.

The next step is converting the integer n to the correct color. We want the bottom donut, n = 0, to be blue (color = 1/3) and the top donut, n = 4, to be red (color = 1). A simple linear function, color = 1/3 + 1/6 n, does not produce very good results. I used the color function color = 1/3 + 1/3 sqrt(n), which maps z = 0 to color = 1/3 and z = 4 to color = 1 like the linear function. However, the new color function makes color take a big jumb between n = 0 and n = 1, but smaller and smaller jumps as n increases.

These graphs were produced by DPGraph, which is a fast program for viewing 3D objects.

Jim Swift's DPGraph page     Jim Swift's home page     Department of Mathematics     NAU