Skip to content

Commit

Permalink
Merge pull request #1291 from skirpichev/fix-24684
Browse files Browse the repository at this point in the history
functions: add _eval_evalf() helper for erfcinv()
  • Loading branch information
skirpichev committed Feb 13, 2023
2 parents 273b204 + 87ebe6f commit 793b38c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion diofant/functions/special/error_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from ...core import (Add, EulerGamma, Function, I, Integer, Pow, Rational,
cacheit, expand_mul, oo, pi, zoo)
cacheit, evaluate, expand_mul, oo, pi, zoo)
from ...core.function import ArgumentIndexError
from ...core.sympify import sympify
from ..combinatorial.factorials import factorial
Expand Down Expand Up @@ -824,6 +824,11 @@ def eval(cls, z):
def _eval_rewrite_as_erfinv(self, z):
return erfinv(1-z)

def _eval_evalf(self, prec):
with evaluate(False):
e = self.rewrite(erfinv)
return e.evalf(prec)


class erf2inv(Function):
r"""
Expand Down
3 changes: 3 additions & 0 deletions diofant/tests/functions/test_error_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ def test_erfcinv():

pytest.raises(ArgumentIndexError, lambda: erfcinv(x).fdiff(2))

# issue sympy/sympy#24684
assert erfcinv(0.4) == 0.59511608144999484


def test_erf2inv():
assert erf2inv(0, 0) == 0
Expand Down
1 change: 1 addition & 0 deletions docs/release/notes-0.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,4 @@ These Sympy issues also were addressed:
* :sympyissue:`24461`: sympy.polys.polyerrors.HeuristicGCDFailed: no luck -- when multiplying two Polys
* :sympyissue:`24543`: Rational calc value error
* :sympyissue:`6326`: PolynomialRing should not derive from CharacteristicZero
* :sympyissue:`24684`: Unable to evaluate erfcinv

0 comments on commit 793b38c

Please sign in to comment.