jacobi-theta 0.2.2.0 → 0.2.2.1
raw patch · 4 files changed
+45/−9 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- jacobi-theta.cabal +1/−1
- src/Math/JacobiTheta.hs +4/−4
- tests/Main.hs +35/−4
CHANGELOG.md view
@@ -1,3 +1,8 @@+## 0.2.2.1 - 2023-10-19 + +More unit tests. + + ## 0.2.2.0 - 2023-10-19 Added the Jacobi theta functions parameterized by `tau` instead of the nome.
jacobi-theta.cabal view
@@ -1,5 +1,5 @@ name: jacobi-theta -version: 0.2.2.0 +version: 0.2.2.1 synopsis: Jacobi Theta Functions description: Evaluation of the Jacobi theta functions. homepage: https://github.com/stla/jacobi-theta#readme
src/Math/JacobiTheta.hs view
@@ -208,10 +208,10 @@ | otherwise = exp(dologtheta4 (z/pi) tau 0 1000) -- | Jacobi theta function with characteristics. This is a family of functions, --- containing the first Jacobi theta function (@a=b=0.5@), the second Jacobi --- theta function (@a=0.5, b=0@), the third Jacobi theta function (@a=b=0@) --- and the fourth Jacobi theta function (@a=0, b=0.5@). The examples given --- below show the periodicity-like properties of these functions: +-- containing the opposite of the first Jacobi theta function (@a=b=0.5@), +-- the second Jacobi theta function (@a=0.5, b=0@), the third Jacobi theta +-- function (@a=b=0@) and the fourth Jacobi theta function (@a=0, b=0.5@). +-- The examples below show the periodicity-like properties of these functions: -- -- >>> import Data.Complex -- >>> a = 2 :+ 0.3
tests/Main.hs view
@@ -2,9 +2,20 @@ import Approx ( approx ) import Data.Complex ( Complex(..) ) import Math.JacobiTheta - ( jtheta1, jtheta2, jtheta3, jtheta4, jtheta1Dash, jtheta1Dash0, jthetaAB ) -import Test.Tasty (defaultMain, testGroup) -import Test.Tasty.HUnit (assertEqual, testCase) + ( jtheta1 + , jtheta2 + , jtheta3 + , jtheta4 + , jtheta1' + , jtheta2' + , jtheta3' + , jtheta4' + , jtheta1Dash + , jtheta1Dash0 + , jthetaAB + , jthetaAB' ) +import Test.Tasty (defaultMain, testGroup) +import Test.Tasty.HUnit (assertEqual, testCase) i_ :: Complex Double i_ = 0.0 :+ 1.0 @@ -72,7 +83,7 @@ (approx 10 obtained) (approx 10 expected), - testCase "Jacobi identity" $ do + testCase "Jacobi identity with the nome" $ do let q''' = 0.556 :+ 0.283 theta2 = jtheta2 0 q''' theta3 = jtheta3 0 q''' @@ -83,6 +94,17 @@ (approx 10 obtained) (approx 10 expected), + testCase "Jacobi identity with tau" $ do + let tau = 5.55 :+ 0.23 + theta2 = jtheta2' 0 tau + theta3 = jtheta3' 0 tau + theta4 = jtheta4' 0 tau + expected = theta3**4 + obtained = theta2**4 + theta4**4 + assertEqual "" + (approx 10 obtained) + (approx 10 expected), + testCase "Edge case" $ do let tau = 0.7792256 :+ 1.0e-7 q'''' = exp(i_ * pi * tau) @@ -99,6 +121,15 @@ assertEqual "" (approx 10 obtained) (approx 10 expected), + + testCase "jtheta1 is minus jthetaAB with a=b=0.5" $ do + let tau = 5.55 :+ 0.23 + z = 0.2 :+ 0.3 + mtheta1 = - jtheta1' z tau + thetaAB = jthetaAB' 0.5 0.5 z tau + assertEqual "" + (approx 10 mtheta1) + (approx 10 thetaAB), testCase "A formula involving some jthetaAB at z=0" $ do let q''' = 0.556 :+ 0.283