Description
It's annoying to have to port functionality between these two packages. It would be better if there were only be one Dual
implementation that development efforts can focus on, if we can get away with it. AFAIK, ForwardDiff's Dual
number is strictly superior to the version implemented in this package - in addition to allowing nested dual (i.e. hyper-dual) numbers and N
partials derivatives at once, it features the same performance as this package's Dual
in the single-element case, and is just as easy to write new derivative definitions for.
I propose we pull out ForwardDiff's Dual
type and place it here instead. Of course, we'd want to ensure that we include any derivative definitions here that are missing from ForwardDiff, and vice versa.
The only controversial part of this change is that ForwardDiff's Dual
is a subtype of Real
, whereas the Dual
here is a subtype of Number
. I would require that we keep the proposed Dual
a subtype of Real
, since the goal of a dual number implementation is to programmatically support the Real
interface. I really don't think this will matter in any practical sense, but others may disagree.