I have been struggling off and on for decades with adjusting my lifestyle so I can go back and digitize/update my mathematics notes from college. I tried at least three times to get into this and failed. Finally, I can declare success. Here is problem #21 from chapter 1 section 1 (1.1) in Calculus with Analytical Geometry, 3rd. Edition, Robert Ellis & Denny Gulick:
The first line of “code” in this problem should be considered pure math. I am making an extra effort to show my work. I assume that most instructors working at UCSB right now would not disagree too much with me. The use of those semi-colons might cause discomfort or even disapproval from the math instructors of my day (in 1988). These semi-colons are the first code-like thing—a Mathematica-specific thing—that the student would have to learn in addition to learning Calculus itself.
The graphical output of
NumberLinePlot would have been more than enough to motivate me to learn Mathematica! In 1988, the ability to use a computer to graph anything was super-awesome!
As I move on to problem #23 I think I am showing a decent balance between traditional notation and the computerized stuff:
Notice that I am now using
Solve for intermediate steps that contribute to the larger problem. Back on #21, I made the effort to “show my work” and deliberately show my 1988 instructor (who may not be alive today) that I am not using Mathematica to cheat.
The use of
VerificationTest is not just a computer language syntax thing—this is a computer programming practice thing. Using tests is the next best thing from the formal mathematical proof. It should teach the student that automated testing is a practical, middle-class thing to do instead of yearning for the elite, academic powers of maths.
To conclude question #23, I am going to use years of software development experience to write lines of code that any C-language-family developer would recognize:
I do not expect the 1988 version of me to ever figure out what I’ve done here. I am very curious to know whether the teachers of the 21st century would embrace this approach.
My take on “teaching kids how to code”…
There is no one, right way to teach any subject. In the case of “coding,” this course is meant to be a general-purpose skill applied to a myriad of disciplines. You could teach coding from a web-browser, model trains or robotics point of view—any point of view that is within the realm of what Stephen Wolfram calls “computational thinking.”
I see now from experience and ideological preference that teaching “kids” how to “code” would be done through teaching mathematics. It should be impossible to teach a child mathematics without using some kind of digital documentation system that records and replays the procedures they use to solve problems. I spent my youth keeping these procedures in the memory of my imagination and I have never found the “photographic memory” a power I should have. What I value is the ability to see a ‘thing’ (real or abstract) and immediately recognizing it such it can be described. This is remembering in real time by seeing this thing in front of you instead of conjuring it from absolutely nothing.
The solution to a mathematical problem is a procedure written in two languages: the human readable language of the students and the math language compatible with the problem. The “learning to code” part of the solution are the tests that verify that a step in the procedure is correct.