FANSolver
A numerical methods solver in a skinned Windows UI
Part 5 of 9 · Early Work
My Numerical Analysis professor asked us to implement the methods from the course. That seemed too boring to stop at, so FANSolver (1999, Visual C++ 6.0 and MFC) wraps them in a dark, bitmap-skinned interface that looked like nothing else on a Windows 98 desktop.

It solves equations five ways (Newton-Raphson, secant, bisection, fixed point and false position), plotting the function and its derivative with zoom and pan. It differentiates the expression you type symbolically, which the assignment never mentioned. A second screen solves matrices and draws Lagrange interpolations and linear and polynomial regressions through points you click onto the plot.
Reading it again
The math I got right is the part nobody asked for. The symbolic derivative applies every rule correctly, including the general power rule for a variable raised to a variable, and Newton-Raphson runs on that exact derivative instead of an estimate. Expressions are evaluated in complex numbers, so the cube root of -8 is -2, and a result with an imaginary part is flagged.
The parser is where it hurts. I wrote it from nothing, around a table of operator priorities,
and gave division a lower priority than multiplication, so x/2*3 means x over 6. A leading
minus becomes its own operator, binding tighter than the power, so -x^2+4 means x^2+4.
Today I’d write a small recursive-descent parser, where precedence is the shape of the grammar.
In 1999 I had never read how anyone else parsed an expression, and the irony is that it was on
the shelf: Stroustrup’s own C++ book, the one everyone writing C++ was told to read, builds a
recursive-descent desk calculator as one of its first examples.
The worst bug is in the units. Trigonometric functions take degrees, which suited a calculator for classmates, but the derivative rules are the ones from the calculus book, which assume radians. The two disagree by a factor of about 57. Ask Newton-Raphson to solve sin(x) = 0.5 from 20 degrees (the answer is 30): at a 1% tolerance it takes one tiny step, to 20.17, and calls it a root. At 0.1% it crawls for 106 iterations and stops at 28.40. The derivative’s plot is 57 times too tall, and I never noticed, because it still had the right shape.
Newton-Raphson also declares an exact root whenever it lands on zero, without checking the
function there: for x^3-2x+2, starting from 1, it announces a root at 0, where the function
is 2. And inverting a matrix swaps only half of each row while pivoting, so the simplest
matrix that needs a pivot, the one that swaps two rows, comes back wrong.
It still has a charm I’d keep: every keystroke in the equation box reparses, simplifies, differentiates and replots, and it reads sen as happily as sin, as a Spanish speaker writes it. For 1999 that live loop was the ambitious part: reparsing, differentiating symbolically and replotting on every keystroke, on the machines of the day, inside a skinned window back when skins were Winamp’s new fashion.
Downloads: the program and its source.
The matrix screen needs Microsoft’s FlexGrid control (MSFLXGRD.OCX) registered. My 1999
download bundled it, but it is Microsoft’s to distribute, so it is not included here. It runs
under Wine on a Mac.
Source and history on GitHub: Kronuz/FANSolver, with the source and the 1999 build.