If you have never heard of Wolfram Alpha and are familiar with Differential Calculus, I suggest you check out this link Differential Calculus Example. Wolfram Alpha does amazing symbolic math. In 1974-75, when I was a senior in High School, I had a friend who was a year ahead of me and was studying Computer Science at MIT. He would come home with another idea for an amazing BASIC program every holiday.
During the Christmas Holiday in 1974, he put together a Symbolic Differentiator in BASIC-PLUS. It was a toy compared to Wolfram Alpha, but it could do Symbolic Differentiation, it just couldn’t simplify the results.
As an example, the input to the program could be “x^2” and the result would be “2x”, or “3x^2 + 2x + 5” would result in “6x + 2”. To use today’s lingo it was freaking insane. You could put in arbitrarily complex expressions, not just polynomials as I’ve shown here. I took Calculus 50 years ago, so polynomials are about all I can muster here.
He had to explain what it was doing, and then I could make sense of the code. In outline form here’s what he did:
Parse the infix expression and convert it into a LISP-style S-expression. He first had to explain what LISP was, and then what an S-expression was. S-expressions are prefix expressions of the form “(operator arg1 arg2)”. So “x^2” becomes “(^ x 2)”.
He used an algorithm from Edsger Dijkstra called Shunting Yard to parse the infix expressions.
The S-expressions could then be analyzed recursively to generate an S-expression that was the derivative of the original S-expression.
Finally, a recursive algorithm could be used to convert the final S-expression into a normal infix expression.
I always tried to re-create what he had done, just to make sure I understood it. I wouldn’t look at his code, so somewhere in the back of my mind, I have this thing stored away. If I were going to try re-creating it, I certainly wouldn’t use old-school BASIC with line numbers and no procedures. With a modern BASIC that supports recursion, it probably wouldn’t be that hard. But again, it’s not as impressive as Wolfram Aplha, which can do Symbolic Simplification, Algebra, Integral Calculus, and much more.
I wanna see the source code!!!
Super nice for academics but doesn’t help the working man much.