From a17bd53598ee5266fc3a1c45f8f4bb4798dc495e Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Fri, 21 Feb 2025 13:35:26 +0100 Subject: Working tests and benchmarks against 'ad' --- src/Numeric/ADDual/Internal.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Numeric/ADDual/Internal.hs b/src/Numeric/ADDual/Internal.hs index 5955fae..1ea3132 100644 --- a/src/Numeric/ADDual/Internal.hs +++ b/src/Numeric/ADDual/Internal.hs @@ -159,9 +159,9 @@ instance (Fractional a, Storable a, Taping s a) => Fractional (Dual s a) where instance (Floating a, Storable a, Taping s a) => Floating (Dual s a) where pi = Dual pi (-1) - exp (Dual x i1) = mkDual (exp x) i1 (exp x) (-1) 0 - log (Dual x i1) = mkDual (log x) i1 (recip x) (-1) 0 - sqrt (Dual x i1) = mkDual (sqrt x) i1 (recip (2*sqrt x)) (-1) 0 + exp (Dual x i1) = mkDual (exp x) i1 (exp x) (-1) 0 + log (Dual x i1) = mkDual (log x) i1 (recip x) (-1) 0 + sqrt (Dual x i1) = mkDual (sqrt x) i1 (recip (2*sqrt x)) (-1) 0 -- d/dx (x ^ y) = d/dx (e ^ (y ln x)) = e ^ (y ln x) * d/dx (y ln x) = e ^ (y ln x) * y/x -- d/dy (x ^ y) = d/dy (e ^ (y ln x)) = e ^ (y ln x) * d/dy (y ln x) = e ^ (y ln x) * ln x Dual x i1 ** Dual y i2 = -- cgit v1.2.3-70-g09d2