Tuesday, February 26, 2008

Derivatives via Trees

For some reason I've started thinking that teaching first semester calculus classes about syntax trees would be beneficial. Mostly I end up thinking about this applied to the process of taking derivatives (using the rules, not the definition), but I feel like its utility should extend beyond that (eg. graph transformations, and general parsing of mathematics).

I'm thinking start the semester teaching students how to take an expression and make its syntax tree (or at least, 'a' syntax tree representing it). So x+sin(3x) would have root '+' with left child 'x', and right child 'apply' with children 'sin' and '*' (with children '3' and 'x'). Then when you get to derivative rules, you can have the derivative rules work on the level of trees. So you re-phrase the derivative rules by saying you work your way down the tree, and if the node is '+' then you leave the node alone and just do the derivatives of the children individually, and if the node is '*' you replace the node with '+' and make the appropriate children... It seems to me that students might like this approach, as it is fairly graphical in nature. Perhaps visual learners will have an easier time remembering the rules if they are presented this way.

Currently I am thinking about difficulties arising in expressions with exponentials. The expressions x^2 and 2^x have fairly different differentiation rules, which should be reflected in their syntax trees. For example, having a node 'pow' with children 'x' and '2', versus having a node 'pow' with children '2' and 'x'... it'd be easy to mess up the rule. I'm thinking the root nodes should have different names, 'pow' and 'exp', for example. So 'pow' -> ('x', '2') would be x^2, and 'exp' -> ('2', 'x') would be 2^x. This convention fits reasonably with the occasional use of exp(x) for e^x. So what about f(x)^g(x)? Avoid the issue by having students rewrite it as e^(g(x)*ln(f(x))) and using a big tree?

What do you think? Any of this seem worth the trouble? I don't remember ever thinking drawing a syntax tree was difficult, so I would hope that teaching it would be relatively quick - maybe just a day in class, with them doing lots of examples. Then they can use this new understanding throughout the semester (and, hopefully, since it is easy, well past that (unlike lots of the other things that get taught...)). Would it help? The tree for the quotient rule will never match a good 'lo d(high) minus high d(lo) then square below' chant.

One question I have is if students need this. Perhaps my perception is wrong, and they already think in these terms. Or they don't think this way, but parsing the function to be differentiated is not where difficulties lie. Presumably in some sort of grade school they made similar diagrams for sentences. I know my memory isn't great, but I don't remember seeing math syntax trees in classes through high school (or even, potentially, in any math classes, just computer science). Anybody know, or have a better impression? Has anybody tried using syntax trees in calc class (or algebra or something), and found that it was something the students already knew, or that the students found useful?

No comments: