“Butter Flys” in Polar Equations
A staple of all of Dr. Tong’s Honors Precalculus courses at Concordia International School Shanghai is the Polar Equations practical application project. This project has taken on many forms, from depicting flowers using polar equations, to undersea creatures, landmark buildings, and most recently, butterflies. Butterflies, or rather “Butter Flys,” has been a slogan beginning late first semester, and so it seemed right to embark on a journey to construct butterflies using polar equations. I settled on the Tiger Mimic Queen, Lycorea Halia. This species of butterfly is found in tropical forests and has a simplistic yet elegant color pattern of orange, black, and peach.
Upon inspecting the photo in Desmos, I could identify the outline of the wings fitting a parabolic curve, with the top and bottom joints of the butterfly resembling a cardioid limacon. I began with what I was most sure of, attempting to find a parabolic equation that would match the outline of the wings, shown in Figure 1.
Using parabolic equations seemed to work well, as evident in the left and right wingtips almost perfectly fitting the red and purple graphs. However, as one traced the wings to the head of the butterfly, they began to deviate from the original equations beginning at the wingtip. I, therefore, pivoted to using multiple parabolic equations to depict the shape of the wings. This required a few hours spent on constructing fine-tuned parabolas that would connect smoothly as well. This can be seen in the image above where the red parabola and blue cardioid limacon (I decided to use a cardioid limacon to represent the middle part of the butterfly) gradually start to deviate the closer they come together, necessitating 3 or more equations for each side of butterfly wings. Adding to that difficulty, I also noticed that the butterfly is not perfectly symmetrical, so the equations would need to be custom-derived for each side of the butterfly.
After a few hours of work, I was able to depict the wings accurately. (Fig. 2) As stated before, I also decided to use a cardioid limacon to depict the middle of the butterfly. However, the general cardioid equations
𝑎±𝑏 𝑐𝑜𝑠𝜃 ±𝜃
and
𝑎±𝑏 𝑠𝑖𝑛𝜃 ±𝜃
are with the (focus?) at the pole, but they are required to be translated to depict the top and bottom of the butterfly. I, therefore, began devising how exactly to translate a polar function, as shown in Figure 3. Translations of rectangular functions are second nature to almost all math students, but our textbook simply didn’t address polar function translation. Luckily, it was soon again proved to me that with the internet anything is possible.
As can be seen in the photo, the equation to translate a polar equation does not take on the form of a regular polar equation, but rather a collection of (x, y) points defined by parametric equations. The first step to arriving at this equation was to determine the limacon equation, of course. This was done with Desmos sliders and was relatively easy, as I could just translate the image itself to compare it with the equation. The next few steps were the difficult ones. A quick Google search for “How to translate polar function” yielded rather confusing answers1 as shown in Figure 4.
I knew I needed to isolate the adding or subtracting of a constant (the units to translate in x or y) from the angle, as simply adding a constant would have the same effect as increasing the angle of 𝜃, but I didn’t quite know how to accomplish this. After many more hours of searching, I arrived at the key to the answer (2). That key was a YouTube video that provided me with the insight needed to derive the formula. The key was leveraging the Chapter 10 material covered in class, parametric equations. Parametric equations use not only the classic variables x and y but also introduce a third variable, t, known as the parameter. Using this variable, different equations can be used to represent the 𝑥 and 𝑦 components of a graph. Using the original equation, I first attempted to directly define 𝑥 and 𝑦, then use the 𝑥 and 𝑦 variables defined previously as a collection of points. However, as you can see in the image below, that only resulted in the “regular” sine and cosine graphs, as shown in Figure 5. Using (𝑥, 𝑦) to attempt to plot points based on these equations yielded even worse results with an outright error, shown in Figure 6.
I had to pivot to a different way of using parametric equations. I realized that first of all, my use of parametric equations was incorrect, they should be fully typed out in the coordinate rather than referred to using 𝑥 and 𝑦. But the equations themselves were also obviously incorrect. I needed “pure equations” in 𝑥 and 𝑦 to use. It then occurred to me through watching the YouTube video that the solution was right under my nose. We learned that to convert polar to rectangular, we can use the 𝑥=𝑟 𝑐𝑜𝑠𝜃 and 𝑦=𝑟 𝑠𝑖𝑛𝜃 identities. If I could determine what 𝑟 was, I could get a “pure equation” of 𝑥 or 𝑦. And I certainly knew what that 𝑟 was. 𝑟 is the original equation without any translations, in this case, 𝑟=1+1sin𝑡. Therefore, by plugging in 𝑟, and entering that into a coordinate, the equation now is set up for translation. From here, if one wants to translate along the axes, one only needs to add a constant to the corresponding 𝑥 or 𝑦 parametric equation in terms of 𝑡. This makes it so that the 𝑥 or 𝑦 value has increased, rather than the theta value increasing, thus allowing for translations of polar equations, such as in Figure 7. However, the angle domain restrictions of 𝑡 do require a bit of trial and error and are what took the most time to get correct.
With this newfound knowledge, I was able to depict the outline of the butterfly using polar limacon equations and rectangular parabolic equations. Rectangular though. Emphasis on rectangular. I needed those parabolic equations in polar form. I thus began simultaneously creating the rectangular equations while also devising a way to convert rectangular equations to polar ones. Once again, I first began by attempting to rearrange equations to yield an expression equal to 𝑟, shown in Figure 8.
As can be seen, though this expression equates to r, simply substituting using the 𝑥 = 𝑟𝑐𝑜𝑠𝜃 and 𝑦 = 𝑟𝑠𝑖𝑛𝜃 equations does not allow for it to be linear in r, as there is r on both sides of the equation. Part of the problem is that I failed to recognize that the converted polar equation “fundamentally didn’t fit the rectangular equation,” I had simply rearranged terms (on the left was originally 𝑟𝑐𝑜𝑠𝜃 simplified to r by moving 𝑐𝑜𝑠𝜃 to the right side). The key to solving this problem was Bennett Tung’s Medium post on his polar project, The Sydney Opera House in Polar Equations (3). As soon as I read through his procedure, it all made sense. The “identity” of the quadratic equation must be preserved by moving all terms to one side to allow one side to equal 0. Only then, are the 𝑥 = 𝑟𝑐𝑜𝑠𝜃 and 𝑦 = 𝑟𝑠𝑖𝑛𝜃 conversions used. Once that is done, r must still be isolated and the whole equation made to equal r. This is done by the Quadratic Formula 𝑥=((-b)+-sqrt(b²-4ac))/(2a), something that all algebra students are familiar with. I finally had a polar equation from a rectangular equation that was accurately converted. The full process is below. Observe how when terms are moved to the other side, they can be grouped and the r² and r can be factored out to make the expression fit the general quadratic equation 𝑎𝑥2+𝑏𝑥+𝑐=0
And so came the “meat and potatoes” of the project, long hours and late nights spent manipulating sliders and arranging equations to create an aesthetically pleasing graph. After 2 months of work, with 80% totally not being done the week before it was due :0, I finally had the almost finished product, portrayed in Figure 10.
My graph was missing a crucial element though, color. Unfortunately, because I had created 80% of the graphs in a very rushed timeframe, the organization went completely out the window. It was up to me, and I to determine which equation corresponded to the location on the butterfly, and manually change the color of all 312 equations. However, Desmos has a rather limited color selection. Thus, I had to create my own colors. This was easier than polar translations or rectangular to polar, but still a crucial step of the project. I utilized a Desmos article (4) that explained how to do it, and I’ll summarize the steps here. First, you need to express the color in a way Desmos understands. Desmos accomplishes this through hue, saturation, value parameters, and HSV. Using a color picker website, I determined the HSV values for the particular shade of peach I wanted. Then, I had to define a color, much as a computer scientist might define a variable. Below is how a color is defined in Desmos, shown in Figure 11:
Then, the color variable must be passed to Desmos’ color palette. This is accomplished using another programming method, a list. The list comprises a color palette variable C, with the elements of the list being the previously defined colors, shown in Figure 12.
Using these custom colors, I was able to make the equations resemble the colors of the butterfly, and the whole butterfly began to materialize before my eyes. One all-nighter later with a lot of frustration due to my earlier disorganization, I finally had a complete Polar Butterfly, along with the knowledge and grit gained through the challenging yet beneficial and rewarding experience that I had in the making of this project, shown in Figure 13.
Links referenced: