Status: Valid
Owner: ----
Labels: Type-Defect Priority-Medium Milestone-Release0.7.3 Evalf

New issue 3910 by asmeu...@gmail.com: Make is_constant smarter about mpmath exceptions
http://code.google.com/p/sympy/issues/detail?id=3910

$ ./bin/test sympy/integrals/tests/test_integrals.py --seed 31507390
==================================================================== test process starts =====================================================================
executable:         /sw/bin/python3  (3.3.2-final-0) [CPython]
architecture:       64-bit
cache:              yes
ground types:       gmpy 2.0.0
random seed:        31507390
hash randomization: on (PYTHONHASHSEED=270778785)

sympy/integrals/tests/test_integrals.py[93] .....fXff....w........................E...................................................... [FAIL]

_______________________________________________________________________ xpassed tests ________________________________________________________________________
sympy/integrals/tests/test_integrals.py: test_issue_1304_2

______________________________________________________________________________________________________________________________________________________________
__________________________________________ sympy/integrals/tests/test_integrals.py:test_integrate_returns_piecewise __________________________________________ File "/users/aaronmeurer/documents/python/sympy/sympy/py3k-sympy/sympy/integrals/tests/test_integrals.py", line 454, in test_integrate_returns_piecewise
    assert integrate(x**(n*y), y) == Piecewise(
  File "./sympy/utilities/decorator.py", line 30, in threaded_func
    return func(expr, *args, **kwargs)
  File "./sympy/integrals/integrals.py", line 1589, in integrate
return integral.doit(deep=False, meijerg=meijerg, conds=conds, risch=risch)
  File "./sympy/integrals/integrals.py", line 888, in doit
antideriv = self._eval_integral(function, xab[0], meijerg=meijerg1, risch=risch, conds=conds)
  File "./sympy/integrals/integrals.py", line 1129, in _eval_integral
    result, i = risch_integrate(f, x, separate_integral=True, conds=conds)
  File "./sympy/integrals/risch.py", line 1552, in risch_integrate
    ans, i, b = integrate_hyperexponential(fa, fd, DE, conds=conds)
File "./sympy/integrals/risch.py", line 1315, in integrate_hyperexponential
    (qa.as_expr().subs(s) / qds, True)
  File "./sympy/functions/elementary/piecewise.py", line 109, in __new__
    r = cls.eval(*newargs)
  File "./sympy/functions/elementary/piecewise.py", line 145, in eval
    cond_eval = cls.__eval_cond(cond)
  File "./sympy/functions/elementary/piecewise.py", line 492, in __eval_cond
    if checksol(cond, {}, minimal=True):
  File "./sympy/solvers/solvers.py", line 206, in checksol
    if not val.is_constant(*list(sol.keys())):
  File "./sympy/core/expr.py", line 530, in is_constant
    b = self._random(None, -1, 0, 1, 0)
  File "./sympy/core/expr.py", line 364, in _random
    nmag = abs(self.evalf(2, subs=reps))
  File "./sympy/core/evalf.py", line 1282, in evalf
    result = evalf(self, prec + 4, options)
  File "./sympy/core/evalf.py", line 1182, in evalf
    r = rf(x, prec, options)
  File "./sympy/core/evalf.py", line 496, in evalf_mul
    arg = evalf(arg, prec, options)
  File "./sympy/core/evalf.py", line 1182, in evalf
    r = rf(x, prec, options)
  File "./sympy/core/evalf.py", line 784, in evalf_log
    re = mpf_log(mpf_add(xre, fone, prec2), prec, rnd)
  File "./sympy/mpmath/libmp/libelefun.py", line 681, in mpf_log
    raise ComplexResult("logarithm of a negative number")
sympy.mpmath.libmp.libmpf.ComplexResult: logarithm of a negative number

================== tests finished: 87 passed, 1 skipped, 3 expected to fail, 1 expected to fail but passed, 1 exceptions, in 64.69 seconds ===================
DO *NOT* COMMIT!

The random seed is important. The issue is that is_constant evaluates at random points, but it doesn't check for this mpmath exception.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy-issues+unsubscr...@googlegroups.com.
To post to this group, send email to sympy-issues@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy-issues.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to