From 6374d7a36099c84a03a958646651da58d2de6d1c Mon Sep 17 00:00:00 2001 From: Iaroslav Date: Sun, 20 Sep 2020 21:05:37 +0700 Subject: [PATCH] Update tests --- .../kotlin/scientifik/kmath/misc/AutoDiffTest.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kmath-core/src/commonTest/kotlin/scientifik/kmath/misc/AutoDiffTest.kt b/kmath-core/src/commonTest/kotlin/scientifik/kmath/misc/AutoDiffTest.kt index aba6c06ca..91d32cf8e 100644 --- a/kmath-core/src/commonTest/kotlin/scientifik/kmath/misc/AutoDiffTest.kt +++ b/kmath-core/src/commonTest/kotlin/scientifik/kmath/misc/AutoDiffTest.kt @@ -202,24 +202,24 @@ class AutoDiffTest { fun testSinh() { val x = Variable(0.0) val y = deriv { sinh(x) } - assertApprox(kotlin.math.sinh(0.0), y.value) // y = sinh(pi/6) - assertApprox(kotlin.math.cosh(0.0), y.deriv(x)) // dy/dx = cosh(pi/6) + assertApprox(kotlin.math.sinh(0.0), y.value) // y = sinh(0) + assertApprox(kotlin.math.cosh(0.0), y.deriv(x)) // dy/dx = cosh(0) } @Test fun testCosh() { val x = Variable(0.0) val y = deriv { cosh(x) } - assertApprox(1.0, y.value) //y = cosh(pi/6) - assertApprox(0.0, y.deriv(x)) // dy/dx = sinh(pi/6) + assertApprox(1.0, y.value) //y = cosh(0) + assertApprox(0.0, y.deriv(x)) // dy/dx = sinh(0) } @Test fun testTanh() { val x = Variable(PI / 6) val y = deriv { tanh(x) } - assertApprox(1.0 / sqrt(3.0), y.value) // y = tan(pi/6) = 1/sqrt(3) - assertApprox(1.0 / kotlin.math.cosh(PI / 6.0).pow(2), y.deriv(x)) // dy/dx = sec(PI/6)^2 + assertApprox(1.0 / sqrt(3.0), y.value) // y = tanh(pi/6) + assertApprox(1.0 / kotlin.math.cosh(PI / 6.0).pow(2), y.deriv(x)) // dy/dx = sech(pi/6)^2 } @Test