implemented a compileable but probably very broken version of http://www.diplom.org/Zine/S2009M/Kruijswijk/DipMath_Chp6.htm