Also, as I've mentioned elsewhere, we should modify limit to just
return a Piecewise expression instead of raising this error. It comes
up a lot (especially if you use symbolic coefficients), and I'd rather
have a Piecewise answer than no answer.

Aaron Meurer

On Mon, Feb 10, 2014 at 7:49 AM, Sergey B Kirpichev
<[email protected]> wrote:
> On Mon, Feb 10, 2014 at 02:30:53AM -0500, Patrick O'Neill wrote:
>>    Sorry, I misremembered: it was a limit, not a derivative.� Here is an MWE:
>>
>>    from sympy import *
>>
>>    x = Symbol('x',positive=True)
>>    z = Symbol('z')
>>
>>    def experiment1():
>>    ��� # Correctly returns oo
>>    ��� print limit(exp(x)**z,z,oo)
>>
>>    def experiment2():
>>    ��� # NotImplementedError: Result depends on the sign of sign(log(exp(x) +
>>    1))
>>    ��� print limit((exp(x) + 1)**z,z,oo)
>>
>>    My best guess about what is happening is that in experiment1, log(exp(x))
>>    is getting analytically simplified to x, but in experiment2 log(exp(x) +
>>    1) is not deduced to be greater than x?
>
> In this case, it's probably a bug in log._eval_is_positive.
>
> This, probably, will fix it:
> diff --git a/sympy/functions/elementary/exponential.py 
> b/sympy/functions/elementary/exponential.py
> index 648934f..a5aee5a 100644
> --- a/sympy/functions/elementary/exponential.py
> +++ b/sympy/functions/elementary/exponential.py
> @@ -674,8 +674,7 @@ def _eval_is_positive(self):
>                  return True
>              if arg.is_infinitesimal:
>                  return False
> -            if arg.is_Number:
> -                return arg > 1
> +            return (arg - 1).is_positive
>
>      def _eval_is_zero(self):
>          # XXX This is not quite useless. Try evaluating log(0.5).is_negative
>
> Test:
>
> In [1]: x = Symbol('x',positive=True)
>
> In [2]: limit(exp(x)**z,z,oo)
> Out[2]: ∞
>
> In [3]: limit((exp(x) + 1)**z,z,oo)
> Out[3]: ∞
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy.
> For more options, visit https://groups.google.com/groups/opt_out.

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

Reply via email to