

| Visual Clarity in the Naming of Variables |
|
|
|
| Wednesday, 01 October 2008 05:46 | ||||
|
The source code below is considered “obfuscated” code, and there is even a contest dedicated to writing such code. However, such code is supposed to be a joke; attempting to read it can be left as a puzzle, but no programmer doing serious work would ever write in such a way.
Mathematicians appear to have no such qualms. They do not think about how the visual presentation of equations may be in a way that causes unnecessary confusion. The Sum of CubesHere is an example from an actual textbook: This is known as the “sum of cubes.” Here is another version of the sum of cubes from a different textbook: To a mathematician, these equations are identical. To a student, the first is far more confusing. “u” and “v” seem both visually and psychologically close together; compare what they look like when handwritten. While the difference seems minor, from my own classroom experience it can be the difference between classroom panic and classroom reassurance. The Unclarity of Single lettersAnother aspect common to the International Obfuscated C Code Contest (which produced the 8 queens example above) is that all variables are named with single letters. By programmers this is considered confusing and bad practice. So why do mathematicians always insist on using single letters? To be fair, in solving 2x + 5 = 9x – 2 and the like starts to get cumbersome if anything longer than x is used. Still, there are occasions where no variable manipulation will occur and a word substitution may be beneficial. Let f be the rational function given by
m and n are psychologically even easier to confuse than u and v. When they’re in small print, for some eyes telling them apart is nearly impossible. Here’s my attempt at clarifying the statements above:
First note the difference in clarity between comparing n and m and top and bottom. It’s like a programmer calling the countdown timer to launch countdown_timer_to_launch rather than just the letter q. I’ve also cut the subscripts and the extra terms, because they’re not needed here. Mathematicians could fuss about the trailing + … implying an infinite series, but they’re already cheating convention with the standard form: The polynomial may only go up to a1x + a0 yet the way the polynomial is written it automatically assumes the number of terms climbs past that. A Different MethodLet’s take something familiar from Algebra I:
What if the same thing was instead defined this way?
It could be understood from the way things are written that slope = m and intercept = b, without having to define on separate lines. This would satisfy mathematical rigor yet give clarity to struggling students. Implied MultiplicationThe aspect of using words for variables that would most raise the hackles of mathematicians is the standard practice that adjacent letters or numbers imply multiplication, so monkey + 5 would refer to six variables (m, o, n, k, e, and y) all multiplied together. Mathematicians have devised special fonts when needed, for example in set theory: Why not do the same thing to allow words as variables? The font would need to be clear, yet distinctive.
Mathematicians are perfectly happy with the system as is, because they are used to keeping vast abstract constructions in their minds. Our students can perhaps join them, but they need scaffolding. Using words when necessary seems a perfectly logical system for bringing mathematical practice more in line with programming practice, allowing outsiders to come and read the “source code” we have written.
Jason Dyer holds degrees in Fine Arts Studies and Math and teaches at Pueblo High School in Arizona. His school mascot is the Warriors and his other blog of residence is The Number Warrior.POSTED ON HOTCHALK.COM Comments (3)
![]()
...
written by vlorbik, October 17, 2008
but, doggone it, n & m
(in your "rational function" example) denote *numbers*, whereas "top" and "bottom" denote ... what, exactly? obviously there's nothing wrong with slang ... but to encourage students to accept it as *better* than precise language carefully used strikes me exactly the wrong way to go (and unnecessary since they generally feel that way already ...). report abuse
vote down
vote up
Votes: +0
... written by Susan B., October 14, 2008
The thing that frustrates me (and confuses my students) more than variable names is functional notation. When a student sees sin(x) = 1/2, he or she always wants to divide both sides by sin. It gets even worse when we say things like sin^2(x) which further emphasizes the idea that we're multiplying sin by something (although to me it looks like we're composing the sine function with itself). And then the notation isn't even consistent: for arcsine we write sin^(-1)(x), which is NOT the same as 1/sin(x).
report abuse
vote down
vote up
Votes: +1
Write comment
|
||||









is a horizontal asymptote.

such that m = the slope, b = the y-intercept
intercept
(ok, maybe not)














than i gave it credit for (small print does
indeed present problems!).