packages feed

jacobi-theta 0.2.2.1 → 0.2.2.2

raw patch · 4 files changed

+18/−4 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+## 0.2.2.2 - 2023-10-31
+
+Allows negative nome.
+
+
 ## 0.2.2.1 - 2023-10-19
 
 More unit tests.
jacobi-theta.cabal view
@@ -1,5 +1,5 @@ name:                jacobi-theta
-version:             0.2.2.1
+version:             0.2.2.2
 synopsis:            Jacobi Theta Functions
 description:         Evaluation of the Jacobi theta functions.
 homepage:            https://github.com/stla/jacobi-theta#readme
src/Math/JacobiTheta.hs view
@@ -112,14 +112,16 @@ 
 -------------------------------------------------------------------------------
 tauFromQ :: Cplx -> Cplx
-tauFromQ q = -i_ * log q / pi
+tauFromQ q = if imagPart q == 0 && realPart q < 0 
+  then 1 :+ (-log(-(realPart q)) / pi)
+  else -i_ * log q / pi
 
 checkQ :: Cplx -> Cplx
 checkQ q
   | magnitude q >= 1 = 
     error "The modulus of the nome must be smaller than one."
-  | imagPart q == 0 && realPart q <= 0 = 
-    error "If the nome is real, it must be positive."
+  | q == 0 = 
+    error "The nome cannot be zero."
   | otherwise = q
 
 getTauFromQ :: Cplx -> Cplx
tests/Main.hs view
@@ -76,6 +76,13 @@         (approx 10 obtained)
         (approx 10 expected),
 
+    testCase "a jtheta3 value with a negative q" $ do
+      let expected = (-23.82995222123) :+ (-12.77832967427)
+          obtained = jtheta3 (1 :+ 1) (-0.730402691048646)
+      assertEqual "" 
+        (approx 10 obtained)
+        (approx 10 expected),
+
     testCase "a jtheta1Dash value" $ do
       let expected = 0.81117649363854416 :+ (-0.89452803853474627)
           obtained = jtheta1Dash (1 :+ 1) q