I recently stumbled upon a problem from Stanford Local ACM Programming Contest (SLPC) 2011.
(original page)
(try the problem yourself here)
So the problem is, in short, given algebraic expressions of trigonometry like $$$x(sin2x + cos2x) − x$$$, you have to determine whether each expression equates to zero, regardless of the value of $$$x$$$.
The intended solution, I am assuming, is to
1) convert the input string into a function of $$$x$$$ that returns the value the same way the expression is described,
2) input multiple values of $$$x$$$ into that function, and
3) confirm the identity if the function always returns zero — within the bounds of float precision error.
Unaware of this idea, I initially tried to solve this problem by building a recursive reduction algorithm. Using the F# language, I made a set of custom algebraic data types