Rose Curve¶
By the end of this lab you'll be able to:
- Plot a rose curve using
r = cos(k * theta)in polar coordinates - Understand how odd
kgiveskpetals and evenkgives2kpetals - Convert polar
(r, theta)to Cartesian(x, y)for plotting
A flower-like curve made from the simple equation r = cos(k*θ). Changing k changes the petal count — odd k gives k petals, even k gives 2k petals.
Welcome to the Rose Curve!
One short equation produces these petal patterns: r = cos(k * theta).
Math at its most beautiful — a whole flower from three characters!
Let's code it together!
How It Works¶
For theta from 0 to 2π (or 4π for even k), compute r = scale * cos(k * theta). Convert to Cartesian: x = r * cos(theta), y = r * sin(theta). Connect the points to trace the petals.
Sample Code¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
What Do You Think Will Happen?
With k=5 (odd), the rule says we get k petals. How many petals is that?
Make your guess — then click Run to find out!
Try It Now¶
5 petals — odd k gives exactly k petals. Were you right?
How It Works¶
When cos(k*theta) < 0, r is negative, which in polar coordinates places the point 180° opposite. This doubles back through the center creating the petal shapes. For even k, the 180° reflection creates an additional set of petals.
Explanation Table¶
| Line | What it does |
|---|---|
r = scale * math.cos(k * theta) |
Polar equation of the rose curve |
x = r * math.cos(theta) |
Convert polar r, theta to x |
y = r * math.sin(theta) |
Convert polar r, theta to y |
k = 5 |
Odd: 5 petals; try k=4 for 8 petals |
Learning Check¶
Your Turn — Try k=4 (even)
Change k = 5 to k = 4. Even k gives 2k petals — so how many petals will appear?
Also change range to range(steps * 2) and divide by steps * 2 for even k.
Predict, then run it!
k=4 → 8 petals (2×4). Even-k rose curves need theta to go from 0 to 4π to complete all petals.
Experiments¶
-
Try k=3. You'll know it worked when 3 petals appear in a triangle arrangement.
-
Use
sininstead ofcos. Replacemath.cos(k * theta)withmath.sin(k * theta). You'll know it worked when the petals rotate 90°/k. -
Draw all odd k from 1 to 9. Use a loop and different colors. You'll know it worked when 5 overlapping rose curves appear.
-
Fill the petals. Call
begin_fill()andend_fill()around the drawing loop. You'll know it worked when the petals are filled in.
Blooming with Math!
One equation — r = cos(k*theta) — draws all these flower patterns!
This is the beauty of polar coordinates: complex shapes from simple equations.
Up next: Spirograph — rolling circles inside circles.