Dealing with the fear of being a boring teacher.

Et miracle : vous recevrez le môme A. C’est complètement priligy billigt sverige nul et non avenu. la fin cialis billigt på nätet de l’individu. ne pas attendre l’arbitre. Le village a sa mairie. Départ pour como comprar nexium com desconto la Cordillera. manque d’accès viagra bästa pris aux soins modernes. » À levitra cena w aptekach la guerre comme à levitra cena w aptekach la guerre. boulevard du colonel Amirouche. tu es dans un autre univers… »2 Merci pour cet éclairage :-) Répondre à cialis pour femme au quebec cet article Je generico viagra 0.58 pensais à plein de choses. Ca achat xenical m’a rappelé que j’avais mis ça de côté. Plutôt säkert att köpa viagra på nätet une grosse bourgade récente. ce qui est intéressant . Et cialis på internet j’ai bossé à droite. entendons-nous bien) acquistare viagra in contrassegno ont fait le déplacement. j’ai aperçu un black qui passait sur la route. souvent accompagnés jag vill köpa kamagra de lettres jag vill köpa kamagra de récriminations.


Mandelbrot Redux: Day 2

I can only imagine what you all think Iowa is like. Fields of corn and soy beans with churches and one-room school houses poking above the waving grain like children o’er the banister on Christmas morning. Overalls and slack-jawed pragmatism. It probably doesn’t help when I say that I’m currently teaching calculus to one (1) student. This is mostly because the rest graduated last week, and I’m dealing with an exceptionally intelligent junior.

Fun Fact! Field Corn is not he same as Sweet Corn (i.e. Corn-on-the-cob). We do not gorge ourselves on the acres of bounty to the point of maizitis. Field Corn is much “grainier” and is the raw starting point for almost all processed foods. (Corn Syrup, Corn Flour, Corn Chips, etc…)

So the question looms: how to take a student from zero understanding of the basics of infinite series, to a moderately strong command of the concepts of sets, series, and imaginary numbers (a la The Mandelbrot Set). This really puts my teaching philosophy to the test. My student’s goal is to write one of those fractal viewing programs from scratch. Do I really believe that this task/question will lead him through all of the necessary content of infinite series? Do I believe that I’ll be able to guide him without coming up with perfect lectures or razzle-dazzle .ppt slides? Yes.

Those of you for whom the words “Real-World” induce seizures, this appears to be the perfect example of something just being pretty enough to grab a kid. He just liked the way they looked, and off we went.

Here’s what happened today:

We checked out the first section in the book on series. This was a weird experience. I sat down next to the kid, and we began looking through the book like it was a child’s picture book. He pointed out things, I pointed out things. He said, “So series are kind of like functions but you only use regular numbers.” (He meant “integers.”) I let him tell me the story of the chapter as we read it. I asked things like, “Why would people come up with this?” and “What’s the motivation for developing series?”

He responded, “I’m not too sure, but it seems like they’re [series] just kind of interesting, like, you don’t know what they’re gonna do.” This kid is totally my favorite student. Not that teachers have favorites or anything.

The beauty of having a one-student class, is that there’s no need for formal assessment. I can just listen to him talk and get a a good idea of what he knows and what he doesn’t. We did a couple of good problems on the board, and then this kid was ready for the big dance.

Programming Mandelbrot:

Series and computers are like peanut butter and jelly or malcontent and HS sophomores. Computers are built to think like this. The for loop structure is basically sigma notation waiting to happen. This student has reasonably proficient skills in the basics of programming. So, we jumped straight to Mandelbrot:

Here’s the kicker, z and c are complex numbers. For high schoolers the words “complex” and “imaginary” are terribly mired in their English denotations. They think that an imaginary number is irrelevant, like an imaginary pot of gold, and they think complex means that they’ll never understand the idea. This is the perfect time to build a little math from scratch. Show them the necessity for imaginary numbers. Why can’t a negative number have a root? Why can’t real and imaginary numbers be combined? This blew my student’s mind as he realized that all real numbers are that way just because their imaginary coefficient is zero.

For those of you that have had complex/imaginary numbers tacked onto your curriculum like an aluminum spoiler on a stock Honda Civic, I really think you should teach the Mandelbrot Set.  I know the Mandelbrot Set is kind of a buzz word, and that fractals themselves are these pretty things that seem to have little direct application, but stay with me.

That’s what I thought too, until I watched this: PBS NOVA RULES. I’m not really a mathematician, in fact I’m a trained assumer and premise-simplifier (physicist), so this is all probably old news to you anyway, but the program is really well put together and you get to hear and see Benoit Mandelbrot in all his Frenchiness!

So what did my student and I do? We watched the show and programmed together. This was fun. He had his program projecting on the board, and we GoogleDoc-ed it.

I taught a mini lecture about the complex plane. I love the concept of the mini lecture. (in edu-jargon: “lecture burst,” which makes me think of pimples and the blueberry girl in the original Willy Wonka.)

Here’s the idea if you’re here for content. All complex numbers have a real and imaginary part (see z above). a reprsents how real the number is, and b represents how imaginary it is. If you plot these two numbers on a plane with axes for real and imaginary you can see all sorts of great stuff:

Shamlessly stolen from wikipedia :(

The Mandelbrot Set accepts complex numbers for the parameter c. (See the recursive statement above, assume Z0 = 0) If you follow out a few terms of series, you can tell if your arbitrary choice for c is going to fly wildly off to infinity or be damned to repeat itself. The values for c that repeat themselves are in the set. The values that fly off are out. This is my stupidly simple way of thinking about sets. You’re either in or out, kind of like Marty McFly being propositioned by future Biff. The numbers that are in make up the set. These numbers turn out to make beautifully haunting images when they’re graphed (in the complex plane).

Here’s the program my student wrote:


function mandel()

for(i=-2; i<=1; i+=0.01)
for(k=-1; k<=1; k+=0.01)
newi = i;
newk = k;
iteration = 0;
iteration_max = 1000;

while((a*a+b*b)<=4 && iteration<=iteration_max)
atemp = a*a - b*b + newi;
b = 2*a*b + newk;
a = atemp;

if(iteration==(iteration_max + 1))
color = "rgb(0,0,0)";
color = "rgb(256,0,0)"
var canvas = document.getElementById("canvas");

var ctx= canvas.getContext("2d");
var fillColor=color
var x=(i+2)*100
var y=(k+1)*100

}//2nd for

}//1st for



<body onload='mandel()'>

<canvas id='canvas' height='400' width='400'> does not support</canvas>


You can run it, if you’d like. Just copy it and save it as a .html document and load it in a browser; you don’t even have to be connected to the Internet (but if you’re reading this, you are already, OMG!) Not the perfect program, but hey, I can’t believe that it works at all.

It relies on the canvas tag, which is total HTML5 butter. You’ll need a fairly modern browser, but, as Meyer puts it, we’re all freaks, so I’ll assume you’re running Chrome 5 or something of similar ilk. Have fun! I think algebra and pre-calc students will enjoy figuring out how we splayed open the imaginary number in order to keep track of its real and imaginary parts.

I’ll explain the program more in the next post. My student is getting really fancy with it. Mouse-click zooming and everything!

Comments are disabled.

13 thoughts on “Mandelbrot Redux: Day 2
  • Sarcasymptote says:

    That is fantastic. Earlier this year I had only a sophomore in class as all of the juniors were on a class trip, and we somehow got sidetracked and, over two days, explored De Moivre’s theorem, Euler’s identity, and a couple other extensions of basic complex number stuff. So much fun! It also makes me wonder what it would be like to not have 32 students in an advanced math class. I wish stuff like this could happen more often.

  • [...] Numbers: The Ricers of Algebra Shawn Cornally: For those of you that have had complex/imaginary numbers tacked onto your curriculum like an [...]

  • Sue VanHattum says:

    There was no error message, but I went back and did what you said, about converting to plain text. It worked partway!

    After it drew about a third (I’m guessing) of the picture, I got a message saying ‘unresponsive script.’

    • Shawn says:

      @Sue: Depending on your browser, there will be a timeout set for any script. The Set take a few minutes to fully render, and your browser may terminate it thinking it’s an infinite loop or something. If you want to get really fancy with this, you’ll need to set this timeout to be much longer than the default setting.

      In firefox’s address bar navigate to “about:config” Then, in the filter bar get the settings for “dom.max_chrome_script_run_time” Double-click the time setting that shows up (probably between 5 and 20) and set it to something much longer like 90-300. These numbers are in seconds, btw.

      For those of you reading this who are thinking “Just use C++ or Java,” you’re right, but my student hasn’t learned those, and I want him to get better at the languages he already knows.


  • Sue VanHattum says:

    OK, I used TextEdit, saved it as an html file, with .html as the extension, and either control click (on a mac) or just double clicking like normal opens it in Firefox, but it simply shows the text of it in a Firefox window – it doesn’t run anything.


  • Sue VanHattum says:

    I’m excited to try this out. I’ve never played with this sort of thing before. But, Shawn, I’m slow sometimes with learning new technology stuff. How do I “load it in a browser”? (And does it matter where I save is as an html document? Like, is Google Docs ok?

    (I’m using Firefox, and I’m on a very old Mac laptop. Because, you know, 5 1/2 years is really old…)

    • Shawn says:

      @Sue: Go even simpler than Google docs. Copy it into TextEdit (OSX) or Notepad (PC) go to “save as” (to the desktop is fine) and make sure the file extension is “.html”. If that gives an error, you may have to convert to plain text which is done in the “format” menu for TextEdit, and God only knows how to do that on a PC. Then just right-click the file and open with a browser!


  • Ben Blum-Smith says:

    That “something I think you’d wanna know” sounded kind of ominous by accident. I just meant, “you are into motivation, I bet you’d dig this…”

    • Shawn says:

      @Ben: That’s awesome! I’m going to show him your comment today. You’re right, I really enjoy motivation especially one as clear as this. Keep reading, your historical knowledge benefits us all. Perhaps we should consider writing some joint history/motivation lessons?


  • Ben Blum-Smith says:

    Something I think you’d wanna know:

    The historical motivation for complex numbers

    I am basically plagiarizing Tristan Needham’s completely awesome book Visual Complex Analysis here.

    The usual birthdate is given as Girolamo Cardano’s Ars Magna (1545) in which he has a very speculative chapter in which he says things like “Suppose you wanted to divide 10 into two parts with a product of 40. Obviously this can’t be done, but calculate like so…” However, he doesn’t completely buy what he’s talking about, and it doesn’t really “take.”

    The book also includes complete algebraic solutions to cubic equations, but Cardano doesn’t do anything with complex numbers (or even negatives, practically) in his exposition of these solutions.

    Something like 35 years later, Rafael Bombelli published a book in which he extensively analyzed the solution to the cubic given by Cardano. The thing about cubics is that they always have at least one real solution. Yet he found that if you applied the Cardano formula to the cubic
    you had to take the square root of a negative. In particular, you get
    x = cube root (2 + sqrt(-121)) + cube root (2 – sqrt(-121))
    Bombelli figured out that if you pretend sqrt(-121) exists and behaves like normal numbers (except for squaring to be negative) then this equals
    2 + sqrt(-1) + 2 – sqrt(-1)
    This is clearly 4, and 4 is a correct solution to the equation.

    So, positing complex numbers allowed the formula to produce a correct real, positive solution. Needham says this is the beginning of their being taken seriously.

  • Blaise Pascal says:

    A quibble and a recollection…

    The quibble is that zn as defined defines a sequence, not a series, and your student’s definition (like a function, only using “regular” numbers) is a fairly decent definition of a sequence. A series is a summed sequence.

    The recollection: I once realized that the Mandelbrot iteration rule zn+1 = zn2+c is possible to do with just Euclidean operations. Squaring a complex number on a plane is doubling an angle (easy to do) and and squaring a distance (a little more tricky, but reasonably doable) and adding a constant offset is as simple as completing a parallelogram. Using a program which models Euclidean construction (and allows you to move key points once set up) I modeled computing up to z5 or so, and could see the orbit that z took for a given value of c.

    It wasn’t as exciting as it sounds.

    • Shawn says:

      @Blaise: Quibble noted, thanks! Recollection: that’s freakin’ awesome. This is why I love comments. I am NOT a mathematician. Thanks!