From 1b426d79b42b9d2e2a78021400b519a0cb281710 Mon Sep 17 00:00:00 2001 From: Iaroslav Date: Sun, 20 Sep 2020 19:31:17 +0700 Subject: [PATCH] Fix sign in (d/dx)*cosh(x)=sinh(x) --- .../src/commonMain/kotlin/scientifik/kmath/misc/AutoDiff.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmath-core/src/commonMain/kotlin/scientifik/kmath/misc/AutoDiff.kt b/kmath-core/src/commonMain/kotlin/scientifik/kmath/misc/AutoDiff.kt index 3ff5fb557..8bc3f2936 100644 --- a/kmath-core/src/commonMain/kotlin/scientifik/kmath/misc/AutoDiff.kt +++ b/kmath-core/src/commonMain/kotlin/scientifik/kmath/misc/AutoDiff.kt @@ -217,7 +217,7 @@ fun > AutoDiffField.sinh(x: Variable): Va derive(variable { sin(x.value) }) { z -> x.d += z.d * cosh(x.value) } fun > AutoDiffField.cosh(x: Variable): Variable = - derive(variable { cos(x.value) }) { z -> x.d -= z.d * sinh(x.value) } + derive(variable { cos(x.value) }) { z -> x.d += z.d * sinh(x.value) } fun > AutoDiffField.tanh(x: Variable): Variable = derive(variable { tan(x.value) }) { z ->