Skip to content

Commit d41ca53

Browse files
committed
Switch to math erf and erfc
1 parent 2aaee72 commit d41ca53

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

requirements-dev.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ pytest-cov
99
sphinx
1010
sphinx-rtd-theme
1111
furo
12-
scipy

src/flint/test/test_arb.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
from flint import arb, ctx
66

7-
from scipy.special import erf, erfc
8-
97
def assert_almost_equal(x, y, places=7):
108
"""Helper method for approximate comparisons."""
119
assert round(x-y, ndigits=places) == 0
@@ -265,8 +263,8 @@ def test_arb_sgn():
265263

266264
def test_arb_erfinv():
267265
"""`arb.erfinv` works as expected."""
268-
midpoint = (erf(1 / 8) + erf(1 / 16)) / 2
269-
radius = midpoint - erf(1 / 16)
266+
midpoint = (math.erf(1 / 8) + math.erf(1 / 16)) / 2
267+
radius = midpoint - math.erf(1 / 16)
270268
arb_val = arb(midpoint, radius)
271269
with ctx.workprec(100):
272270
actual = arb_val.erfinv()
@@ -278,15 +276,21 @@ def test_arb_erf():
278276
arb_val = arb(2, 1)
279277
with ctx.workprec(100):
280278
actual = arb_val.erf()
281-
true_interval = arb((erf(1) + erf(3)) / 2, (erf(1) + erf(3)) / 2 - erf(1))
279+
true_interval = arb(
280+
(math.erf(1) + math.erf(3)) / 2,
281+
(math.erf(1) + math.erf(3)) / 2 - math.erf(1)
282+
)
282283
assert true_interval in actual
283284

284285
def test_arb_erfc():
285286
"""`arb.erfc` works as expected."""
286287
arb_val = arb(2, 1)
287288
with ctx.workprec(100):
288289
actual = arb_val.erfc()
289-
true_interval = arb((erfc(1) + erfc(3)) / 2, (erfc(1) + erfc(3)) / 2 - erfc(3))
290+
true_interval = arb(
291+
(math.erfc(1) + math.erfc(3)) / 2,
292+
(math.erfc(1) + math.erfc(3)) / 2 - math.erfc(3)
293+
)
290294
assert true_interval in actual
291295

292296
def test_arb_const_pi():

0 commit comments

Comments
 (0)