ad icon indicating copy to clipboard operation
ad copied to clipboard

Discrepancies Between Different Modes

Open julmb opened this issue 11 months ago • 1 comments

While investigating #108, I came across some more discrepancies between differentiation modes.

>>> import Numeric.AD.Mode.Forward as F
>>> import Numeric.AD.Mode.Reverse as R
>>> F.diff cos 0
>>> R.diff cos 0
-0.0
0.0
>>> import Numeric.AD.Mode.Forward as F
>>> import Numeric.AD.Mode.Reverse as R
>>> let f x = log (1 - exp x)
>>> F.diff (F.diff f) 0
>>> R.diff (R.diff f) 0
-Infinity
NaN

These examples may be somewhat contrived, but given the nature of algebra, I feel like any discrepancy could probably be amplified to yield significantly different results given the right circumstances.

julmb avatar Mar 08 '24 14:03 julmb