diff options
author | Tom Smeding <t.j.smeding@uu.nl> | 2025-02-21 13:35:26 +0100 |
---|---|---|
committer | Tom Smeding <t.j.smeding@uu.nl> | 2025-02-21 13:35:26 +0100 |
commit | a17bd53598ee5266fc3a1c45f8f4bb4798dc495e (patch) | |
tree | ee7962f603fbb26a0df0f793b8e50666f41a0dfd /src | |
parent | b91d36fa38be07397b505433f24a6d29a79c2642 (diff) |
Working tests and benchmarks against 'ad'
Diffstat (limited to 'src')
-rw-r--r-- | src/Numeric/ADDual/Internal.hs | 6 |
1 files changed, 3 insertions, 3 deletions
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 = |