# Tag Archives: syntax

## Computers vs. People: Writing Math

Readers of this ‘blog know I actively use many forms of technology in my teaching and personal explorations.  Yesterday, a thread started on the AP-Calculus community discussion board with some expressing discomfort that most math software accepts sin(x)^2 as an acceptable equivalent to the “traditional” handwritten $sin^2 (x)$.

From Desmos:

Some AP readers spoke up to declare that sin(x)^2 would always be read as $sin(x^2)$.  While I can’t speak to the veracity of that last claim, I found it a bit troubling and missing out on some very real difficulties users face when interpreting between paper- and computer-based versions of math expressions.  Following is an edited version of my response to the AP Calculus discussion board.

MY THOUGHTS:

I believe there’s something at the core of all of this that isn’t being explicitly named:  The differences between computer-based 1-dimensional input (left-to-right text-based commands) vs. paper-and-pencil 2-dimensional input (handwritten notation moves vertically–exponents, limits, sigma notation–and horizontally).  Two-dimensional traditional math writing simply doesn’t convert directly to computer syntax.  Computers are a brilliant tool for mathematics exploration and calculation, but they require a different type of input formatting.  To overlook and not explicitly name this for our students leaves them in the unenviable position of trying to “creatively” translate between two types of writing with occasional interpretation differences.

Our students are unintentionally set up for this confusion when they first learn about the order of operations–typically in middle school in the US.  They learn the sequencing:  parentheses then exponents, then multiplication & division, and finally addition and subtraction.  Notice that functions aren’t mentioned here.  This thread [on the AP Calculus discussion board] has helped me realize that all or almost all of the sources I routinely reference never explicitly redefine order of operations after the introduction of the function concept and notation.  That means our students are left with the insidious and oft-misunderstood PEMDAS (or BIDMAS in the UK) as their sole guide for operation sequencing.  When they encounter squaring or reciprocating or any other operations applied to function notation, they’re stuck trying to make sense and creating their own interpretation of this new dissonance in their old notation.  This is easily evidenced by the struggles many have when inputting computer expressions requiring lots of nested parentheses or when first trying to code in LaTEX.

While the sin(x)^2 notation is admittedly uncomfortable for traditional “by hand” notation, it is 100% logical from a computer’s perspective:  evaluate the function, then square the result.

We also need to recognize that part of the confusion fault here lies in the by-hand notation.  What we traditionalists understand by the notational convenience of sin^2(x) on paper is technically incorrect.  We know what we MEAN, but the notation implies an incorrect order of computation.  The computer notation of sin(x)^2 is actually closer to the truth.

I particularly like the way the TI-Nspire CAS handles this point.  As is often the case with this software, it accepts computer input (next image), while its output converts it to the more commonly understood written WYSIWYG formatting (2nd image below).

Further recent (?) development:  Students have long struggled with the by-hand notation of sin^2(x) needing to be converted to (sin(x))^2 for computers.  Personally, I’ve always liked both because the computer notation emphasizes the squaring of the function output while the by-hand version was a notational convenience.  My students pointed out to me recently that Desmos now accepts the sin^2(x) notation while TI Calculators still do not.

Desmos:

The enhancement of WYSIWYG computer input formatting means that while some of the differences in 2-dimensional hand writing and computer inputs are narrowing, common classroom technologies no longer accept the same linear formatting — but then that was possibly always the case….

To rail against the fact that many software packages interpret sin(x)^2 as (sin(x))^2 or sin^2(x) misses the point that 1-dimensional computer input is not necessarily the same as 2-dimensional paper writing.  We don’t complain when two human speakers misunderstand each other when they speak different languages or dialects.  Instead, we should focus on what each is trying to say and learn how to communicate clearly and efficiently in both venues.

In short, “When in Rome, …”.

## An unexpected lesson from technology

This discovery happened a few years ago, but I’ve just started ‘blogging, so I guess it’s time to share this for the “first” time.

I forget whether my calculus class at the time was using the first version of the TI-Nspire CAS or if we were still on the TI-89, but I had planned a very brief introduction to the CAS syntax for computing symbolic derivatives, but my 5-minute introduction in the first week of introducing algebraic rules of derivatives ended up with my students discovering antiderivative rules simply because they had technology tools which allowed them to explore beyond where their teacher had intended them to go.

They had absolutely no problem computing algebraic derivatives of power functions, so the following example was used not to demonstrate the power of CAS, but to give easily confirmed outputs.  I asked them for the derivative of $x^5$, and their CAS gave the top line of the image below.

(In case there are readers who are TI-Nspire CAS users who don’t know the shortcut for computing higher order derivatives, use the left arrow to place the cursor after the dx in the “denominator” of $\frac{d}{dx}$ and press the carot (^) key.  Then type the integer of the derivative you want.)

I wanted my students to compute the 2nd and 3rd derivatives and confirm the power rule which they did with the following screen.

That was the extent of what I wanted at the time–to establish that a CAS could quickly and easily confirm algebraic results whether or not a “teacher” was present.  Students could create as many practice problems as were appropriate for themselves and get their solutions confirmed immediately by a non-judgmental expert.  Of course, one of my students began to explore in ways my “trained” mind had long ago learned not to do.  In my earlier days of CAS, I had forgotten the unboundedness of mathematical exploration.

Shortly after my syntax 5-minutes had passed and I had confirmed everyone could handle it, a young man called me to his desk to show me the following.

He understood what a 1st or 2nd derivative was, but what in the world was a negative 1st derivative?  Rather than answering, I posed it to the class who pondered a few moments before recognizing that “underivatives” (as they called them in that moment) of power functions added one to the current exponent before dividing by the new exponent.  They had discovered and explained (at least algebraically) antiderivatives long before I had intended.  Technology actually inspired and extended my students’ learning!

Then I asked them what the CAS would give if we asked it for a 0th derivative.  It was another great technology-inspired discussion.

I really need to explore more about the connections between mathematics as a language and the parallel language of technology.