Here’s the code:

void setup() {

size(600, 400);

}

void draw() {

//Sky-blue background

background(0, 191, 255);

//For the drawFlower function, enter the x-coordinate of the flower’s center,

//the y-coordinate, and the r, g, b values for the petals.

drawFlower(100, 85, color(255, 255, 0));

drawFlower(200, 100, color(255,69,0));

drawFlower(150, 200, color(218,112,214));

drawFlower(300, 225, color(230,230,250));

drawFlower(400, 80, color(250,250,210));

drawFlower(480, 150, color(255,99,71));

drawFlower(440, 230, color(138,43,226));

}

void drawFlower(int centerX, int centerY, color c) {

//Draw the stem

stroke(0, 255, 100);

strokeWeight(4);

line(centerX, centerY + 15, centerX, centerY + 115);

//Draw the leaves

fill(0, 255, 100);

ellipse(centerX-40, centerY+40, 80, 20);

ellipse(centerX+40, centerY+40, 80, 20);

//Draw the center of the flower

stroke(0);

fill(0);

ellipse(centerX, centerY, 30, 30);

//Draw the petals

stroke(c);

fill(c);

ellipse(centerX, centerY+40, 20, 40);

ellipse(centerX-40, centerY, 40, 20);

ellipse(centerX+40, centerY, 40, 20);

ellipse(centerX, centerY-40, 20, 40);

}

Filed under: Coding, computer science Tagged: coding, Daniel Shiffman, functions, Learning Processing, Processing ]]>

You can view the actual project here: https://www.openprocessing.org/sketch/480556#

Here is the code:

float x = 200;

float y = 0;

int speedX = 1;

float speedY = 0;

float gravity = 0.1;

void setup() {

//Set window size

size(800,600);

}

void draw() {

//Draw a black background

background(0);

//Set ellipses and rects to CENTER mode

ellipseMode(CENTER);

rectMode(CENTER);

//Change the x location by speedX

x = x + speedX;

//If dog reaches edge, reverse course

if ((x > width)|(x < 0)) {

speedX = speedX*-1;

}

//Start y dropping

y = y + speedY;

speedY = speedY + gravity;

//Draw the body

strokeWeight(5);

stroke(100,0,0);

fill(0.5*x,y,x);

rect(x, y, 300,150);

//Draw the head

fill(200,50,50);

ellipse(x+225, y, 150,200);

//Draw the mouth and nose

strokeWeight(10);

line(x + 200, y + 40, x + 250, y + 40);

line(x + 225, y – 25, x + 225, y + 25);

//Draw the eyes

strokeWeight(0);

fill(0,50,200);

ellipse(x + 200, y- 30, 30, 50);

ellipse(x + 250, y – 30, 30, 50);

//Draw the legs

strokeWeight(20);

line(x – 100,y + 75,x – 150, y + 150);

line(x – 100, y + 75, x – 50, y + 150);

line(x + 100, y + 75, x + 50, y + 150);

line(x + 100, y + 75, x + 150, y + 150);

//Draw the tail

strokeWeight(25);

line(x – 150,y, x – 250, y – 100);

//Bounce back up

if (y > height) {

speedY = speedY*-0.95;

y = height;

}

}

Filed under: Coding, computer science Tagged: coding, Daniel Shiffman, Learning Processing, Processing ]]>

- Plot a point (x0, y0) anywhere inside the triangle.
- Use a random number generator to generate 1, 2, or 3 randomly.
- If 1 comes up, plot the midpoint between vertex #1 and (x0, y0).
- If 2 comes up, plot the midpoint between vertex #2 and (x0, y0).
- If 3 comes up, plot the midpoint between vertex #3 and (x0, y0).
- Make your new point (x0, y0).
- Repeat the process.

Even though the locations of the points are being generated randomly, a very interesting picture emerges. Here is after 100 iterations:

And here is the result after 1000 iterations:

And here it is after 10,000. It’s pretty clear that we’re getting the Sierpinski Triangle!

Here’s the code:

float x1 = width/2;

float y1 = 0;

float x2 = 0;

float y2 = height;

float x3 = width;

float y3 = height;

float x0 = width/2;

float y0 = height/2;

size(600, 600);

background(0);

stroke(255);

frameRate(5);

for (int i = 1; i < 10000; i = i + 1) {

int roll = int (random(0, 4));

if (roll == 1) {

x0 = (x0 + x1)/2;

y0 = (y0 + y1)/2;

point(x0, y0);

} else if (roll == 2) {

x0 = (x0 + x2)/2;

y0 = (y0 + y2)/2;

point(x0, y0);

} else {

x0 = (x0 + x3)/2;

y0 = (y0 + y3)/2;

point(x0, y0);

}

}

Filed under: Coding, computer science, Education, Fractals, Math Tagged: iterated function systems, Processing, Sierpinski Triangle ]]>

Here’s a gif of 3 seconds of it in action:

Filed under: Coding, computer science Tagged: coding, Daniel Shiffman, Learning Processing, Processing ]]>

Processing uses simple commands like *ellipse(centerX, centerY, width, height)*, or *line(X1, Y1, X2, Y2)*. If you’re familiar with coordinate geometry, then coding in Processing is a piece of cake. And did I mention it’s open-source, which means it’s completely free? The Processing website (linked above) has a fantastic reference that covers all of the commands and their parameters.

Here is my first project, which is the result of working through the first three chapters. I think I’ll call him Hypno-Dog, because I made his eyes change color.

Filed under: Coding, Education Tagged: computer graphics, Daniel Shiffman, Processing ]]>

Why are they called conics? Well, we can construct them using cones, as illustrated by this demo, courtesy of

Here are my screencasts:

Conic Basics

The Parabola

The Ellipse

The Hyperbola

Filed under: Math Tagged: Algebra, conic sections, ellipses, hyperbolas, mathematics, parabolas ]]>

Here are the parameters:

Filed under: Fractals Tagged: Chaoscope ]]>

Filed under: Artglass, Education, Math Tagged: #MathArt, Light Math Color, stained glass ]]>

I’ve discovered a nice podcast that is produced by the BBC: In Our Time. Melvyn Bragg hosts a different group of guests every week, depending on the topic being discussed, which can be anything related to the history of ideas. I’ve enjoyed hearing how the Book of Common Prayer came to be, the significance of George Orwell’s Animal Farm, and how radio was invented, among many interesting topics. Melvyn keeps things moving along, and the guests are always very knowledgeable and entertaining.

Of course, I most enjoy the math-related conversations, so for my fellow math teachers here is a list of the programs – at least the ones I’ve found so far – that are devoted to that subject (click on the title to go to that program’s download page):

Maths and Storytelling (September 10, 1999)

Mathematics and Platonism (January 11, 2001)

Renaissance Maths (June 2, 2005)

Mathematics and Music (May 25, 2006)

The Fibonacci Sequence (November 29, 2007)

Mathematics’ Unintended Consequences (February 10, 2010)

Imaginary Numbers (September 22, 2010)

Random and Pseudorandom (January 12, 2011)

Fermat’s Last Theorem (October 24, 2012)

Euclid’s Elements (April 28, 2016)

Zeno’s Paradoxes (September 21, 2016)

You can subscribe to the In Our Time podcast via iTunes by clicking here.

Happy listening!

Update: Here’s a new one – Maths In The Early Islamic World.

Filed under: Education, Math Tagged: BBC, history of math, In Our Time, Podcasts ]]>

If you’re really bored and want to binge-watch them, here you are:

Filed under: Education, Math Tagged: absolute value, Algebra 2, completing the square, functions, graphing, inequalities, linear inequalities, quadratic equations, radical equations, screencasts, transformations ]]>

I’ve been using Desmos to brainstorm window designs. It’s so easy to plot polar graphs with it, and they usually have a lot of symmetry. For this particular design, I played around with a tangent plot. In Desmos, I entered r = a*tan(b*theta) + c, and created sliders for a, b, and c. Then I adjusted them until I found a promising design; in this case a = 1.8, b = 1.6, and c = 5.3:

Next, I printed out the design and traced it onto a large sheet of paper. This will be my working pattern, called a *cartoon*:

Now comes the most time-consuming step: cut all the pieces of glass to fit into the cartoon. I decided to go with green in the center, then alternate clear, blue, and yellow pieces as you work out from the center. Here are the pieces of glass as I cut them in stages:

Once all the pieces are cut (make sure there are no pieces overlapping their boundaries), I wrapped them in copper foil tape. It’s exactly like it sounds: copper with a sticky backing.

Now the window is ready for soldering. I brush all the copper with flux (a chemical that enables the lead/tin solder to adhere to the copper tape), and then use a soldering iron to melt the solder onto the tape. I do this on both sides. On the front side, I add more solder to “raise a bead” and make it look finished. Here’s the result:

The ease with which Desmos plots complicated polar equations makes it an ideal tool to design symmetric artglass windows. I think this is the beginning of a beautiful relationship!

**Update: **I’ve made three more windows using Desmos.

This one uses the polar plot of r = 1.9tan(0.3θ) – 5.1:

r = 0.3sec(1.6θ) – 3.65:

r = sqrt(10sin(3.3θ)) – 6:

And two more:

r = -2.8³√(csc(0.6θ) + 0.8):

r = tan(0.5θ) + sin(0.8θ):

Filed under: Artglass, Math Tagged: Desmos.com, polar graphs ]]>

**Love and Math: The Heart of Hidden Reality**, by Edward Frenkel. This is a terrific book about Frenkel’s struggles to overcome institutional anti-Semitism in his native Russia and become a world-class mathematician. He is currently a professor of mathematics at UC Berkeley. He intersperses autobiographical details with explanations of how his mathematical research helped physicists develop their theories of quantum mechanics, as well as unite seeming unconnected branches of math. Along the way, he shares his love of the Platonic world of mathematics: “Nothing can stop us from delving deeper into this Platonic reality and integrating it into our lives. What’s truly remarkable is mathematics’ inherent democracy: while some parts of the physical and mental worlds may be perceived or interpreted differently by different people or may not even by accessible to some of us, mathematical concepts and equations are perceived in the same way and belong to all of us *equally*. No one can have a monopoly on mathematical knowledge; no one can claim a mathematical formula or idea as his or her invention; no one can patent a formula!” (pp. 235-236) Frenkel delves into some very deep and advanced mathematics, but he manages to explain it terms most everyone can understand.

**Program Or Be Programmed: Ten Commands For A Digital Age**, by Douglas Rushkoff. My daughter gave me this book after she read it for a coding class in college. It is in the vein of Neil Postman, asking users of social media to be aware of digital technologies’ inherent biases. It’s relatively short, but very powerful. Rushkoff’s main point is that unless users understand basic coding principles, they will be at the mercy of an élite who create the social media platforms that can manipulate them. The ten commands are:

- Time: Do Not Be Always On
- Place: Live In Person
- Choice: You May Always Choose None of the Above
- Complexity: You Are Never Completely Right
- Scale: One Size Does Not Fit All
- Identity: Be Yourself
- Social: Do Not Sell Your Friends
- Fact: Tell The Truth
- Openness: Share, Don’t Steal
- Purpose: Program or Be Programmed

Favorite quote: “In a digital culture that values data points over context, everyone comes to believe they have the real answer and that the other side is crazy or evil.” (p. 65)

**This Is Your Brain On Music: The Science of a Human Obsession**, by Daniel Levitin.

This technically isn’t a book about math, but if you’ve ever wondered why humans are the only animals to create and appreciate music, then you will enjoy this. Levitin knows what he’s talking about: he’s been a record producer of very successful rock artists, and he is now a neuroscientist at McGill University, where he runs the Laboratory for Musical Perception, Cognition, and Expertise.

Levitin spends the first few chapters explaining what music is, and what terms like *pitch, timbre, rhythm, *and *tempo* mean. He also discusses the mathematical relationships in tones and octaves.

Levitin spends the rest of the book explaining the latest research in how the brain processes music, and what is involved in creating, performing, and enjoying it. No other activity involves as many parts of the brain as performing music does. He laments the separation between performer and audience that has happened in western cultures. In earlier times, *everyone *played some sort of instrument or sang. The easy availability of recorded music has caused a decline in music performance, however, to the detriment of us all.

So, three books with three very different foci, but I believe teachers of mathematics will find all of them interesting and enjoyable. Have a great summer!

Filed under: Coding, Literature, Math, Music Tagged: Daniel Levitin, Douglas Rushkoff, Edward Frenkel, Love And Math, Program Or Be Programmed, This Is Your Brain On Music ]]>

Last year, I went to the regional NCTM conference here in Nashville, TN, and one of the sessions I attended addressed this exact issue. Nina Chung Otterson was the presenter, and she teaches at The Hotchkiss School in Connecticut. She has her students cut cross-sections of different shapes and apply them to a base area enclosed by two parabolas, y = x^2 – 3 and y = 3 – x^2.

Here’s what the base area looks like, courtesy of Desmos.com’s online function grapher:

In her session, Nina Otterson provided templates that fit the given base area for different shapes: semicircles, squares, and equilateral triangles. I had my students cut the square templates diagonally for isosceles right triangles, and horizontally for rectangles. Students use the templates to cut out a cross-section that fits down the middle of the base area, and six others on each side.

Here are my students in action, cutting out the cross-sections:

Here they are, taping the cross-sections onto the base area:

And here are the finished models:

Once they understood that the thickness of the paper was dx, it was very easy to set up the integrals to calculate the volumes of their models. I’ve never had students grasp the idea behind this type of volume as quickly and as easily as this group did. Building a model using actual cross-sections made all the difference!

When I do this activity next year, I think I’ll glue the base area to foamboard, and have students insert the cross-sections into slits cut into the foamboard. That way, they will stand up straighter and stay evenly spaced.

You can download the templates provided by Nina Otterson here.

Update: I used spray adhesive to glue the base area to some foamboard and cut slits in it with an Xacto knife. Then I carefully slid each cross-section into its appropriate slit. It worked great! Now each cross-section stands nicely spaced and vertical.

Filed under: Active Learning, Education, Math Tagged: calculus, Nina Chung Otterson, solids of known cross-sections, The Hotchkiss School ]]>

I used a Geogebra activity created by Alex Kasantsidis to demonstrate a simple Riemann sum. We discussed how the sum of the rectangles can either overestimate or underestimate the area under the parabola, and how we can get a better approximation of the area by increasing the number of rectangles used.

Then, I had my students work through an activity (you can download it here) to estimate the area under the curve y = 12 – x^2 for x = -1 to x = 3 using eight rectangles. After averaging the left-hand and right-hand sums, they came up with 38.5. The actual area is 38.66…, so with only eight rectangles they achieved very good results!

What my students enjoyed even more, though, was the satisfaction of learning calculus-level mathematics. Hopefully, this activity allayed some of the apprehension they might have when they hear the word “calculus”.

Filed under: Education, Math Tagged: Alex Kasantsidis, area under a curve, calculus, GeoGebra, geometry, polygon area, Riemann sums ]]>

I shared his findings with all the English teachers at my school, and they were really interested in the information one can glean from this analysis.

Check out Calhoun’s post to see some beautiful “heatmaps” of famous novels. They look like Rothko paintings.

Filed under: Literature Tagged: Absalom Absalom, Adam J. Calhoun, Blood Meridian, Cormac McCarthy, medium.com, punctuation in novels, William Faulkner ]]>