I've set up a new branch for playing with hyperduals. https://github.com/DeepSOIC/FreeCAD-ell ... HyperDuals

The first implementation, based on recursive templates, is mostly up. It is different from cppduals, but I did look at cppduals' source code for some hints.

I have tested it by computing (x^4-x^2) at x=1, and it spitted out correct values of three derivatives. So i consider the concept proven.

The complexity of computation seems to be exponential for the number of derivatives. While it sounds bad, since I don't think we ever need derivatives higher than 3, it may not be a problem. Implementing functions is very easy.

I plan to at least try the alternative "brute-force" approach, with all derivatives stored in an array. This is going to be a lot more code, but the complexity seems to be n^3, and may even be further improved.

Then I will probably compare the two implementations to pick the faster one.