Skip to content

Commit

Permalink
XXX correct LambertW assumption helpers
Browse files Browse the repository at this point in the history
LambertW._eval_is_extended_real now more conservative.
  • Loading branch information
skirpichev committed Aug 27, 2016
1 parent 2b59214 commit c2ddd7e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 2 additions & 5 deletions diofant/functions/elementary/exponential.py
Expand Up @@ -513,12 +513,9 @@ def _eval_is_extended_real(self):
elif (x + 1/S.Exp1).is_nonpositive:
return False
elif (k + 1).is_zero:
if x.is_negative and (x + 1/S.Exp1).is_positive:
if x.is_negative and (x + 1/S.Exp1).is_nonnegative:
return True
elif x.is_nonpositive or (x + 1/S.Exp1).is_nonnegative:
return False
elif k.is_nonzero and (k + 1).is_nonzero:
if x.is_extended_real:
elif x.is_nonpositive or (x + 1/S.Exp1).is_positive:
return False

def _eval_is_algebraic(self):
Expand Down
5 changes: 3 additions & 2 deletions diofant/functions/elementary/tests/test_exponential.py
Expand Up @@ -364,13 +364,14 @@ def test_lambertw():
assert LambertW(-p - 2/S.Exp1, evaluate=False).is_extended_real is False
assert LambertW(S.Half, -1, evaluate=False).is_extended_real is False
assert LambertW(-S.One/10, -1, evaluate=False).is_extended_real
assert LambertW(-10, -1, evaluate=False).is_extended_real is False
assert LambertW(-2, 2, evaluate=False).is_extended_real is False

assert LambertW(0, evaluate=False).is_algebraic
na = Symbol('na', nonzero=True, algebraic=True)
assert LambertW(na).is_algebraic is False

assert LambertW(x, -1).is_extended_real is None
assert LambertW(x, 2).is_extended_real is None

# See sympy/sympy#7259:
assert LambertW(x).series(x) == x - x**2 + 3*x**3/2 - 8*x**4/3 + \
125*x**5/24 + O(x**6)
Expand Down

0 comments on commit c2ddd7e

Please sign in to comment.