Issue : limit(abs(log(x)),x,0,'+')

105 views
Skip to first unread message

Arnaud Usciati

unread,
Jan 31, 2015, 10:33:40 AM1/31/15
to sy...@googlegroups.com
Hello,

limit(abs(log(x)), x, 0, '+') should return +oo, but it returns -oo*sign(log(_w)) !!!


Aaron Meurer

unread,
Jan 31, 2015, 2:24:51 PM1/31/15
to sy...@googlegroups.com
That's definitely a bug (Dummy values should never leak out of functions). Can you open an issue for it?

Aaron Meurer

On Sat, Jan 31, 2015 at 9:33 AM, Arnaud Usciati <rai...@gmail.com> wrote:
Hello,

limit(abs(log(x)), x, 0, '+') should return +oo, but it returns -oo*sign(log(_w)) !!!


--
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 sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/c1d1e406-ac4d-487e-807a-d0483cc6d7b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Douglas Lohmann

unread,
Feb 6, 2015, 6:55:06 PM2/6/15
to sy...@googlegroups.com
In my test it's not a bug. You can explain better?

In [9]: limit(abs(log(x)), x, 0, '+')
Out[9]: oo

It was already reported the bug to the bug list?

Ondřej Čertík

unread,
Feb 6, 2015, 7:46:57 PM2/6/15
to sympy

Aaron Meurer

unread,
Feb 6, 2015, 10:11:40 PM2/6/15
to sy...@googlegroups.com
Be sure to test against SymPy master. As Ondrej pointed out, this used to work, but it got broken.

Aaron Meurer

--
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 sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.

Ondřej Čertík

unread,
Feb 6, 2015, 11:08:05 PM2/6/15
to sympy
The limits will have to be debugged, essentially we just need to go
step by step and see which routine returns the wrong answer.

Ondrej
> https://groups.google.com/d/msgid/sympy/CAKgW%3D6L30%3Dh4-b6r2S_1c7tZ%3Deu8n7zFWcCBQOcTaN3f1MbnMA%40mail.gmail.com.

Arnaud Usciati

unread,
Feb 11, 2015, 4:37:13 AM2/11/15
to sy...@googlegroups.com
Hi,

I found another error limit :
If x = symbols('x', positive=True), limit(tan(abs(x))/acosh(x), x, pi/2, '-') returns oo --> OK
If x = symbols('x', real=True), limit(tan(abs(x))/acosh(x), x, pi/2, '-') returns oo*sign(1/Subs(Derivative(re(_x), _x), (_x,), (0,))) !!

I guess the first result is correct because sympy can evaluate abs(x) to x for x positive, but for x real it can't simplify the function and calculate the limit !

Christophe Bal

unread,
Feb 11, 2015, 6:27:23 AM2/11/15
to sympy-list

Hello.

Maybe, it could be useful to have a abssimplify method that will try to simplify abs expressions.

Christophe BAL

> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/5feb0587-b775-4922-ba30-6841a41821af%40googlegroups.com.

Arnaud Usciati

unread,
Feb 12, 2015, 2:26:32 PM2/12/15
to sy...@googlegroups.com
Hello,

Maybe abs() function have to be reconsidered, because I found other issues with abs...

limit(abs(ln(x))-ln(x), x, 2) or limit(abs(ln(x))-ln(x), x, 2, '+') return 0 (OK), but limit(abs(ln(x))-ln(x), x, 2, '-') runs endless and I need to interrupt it to stop calculating.. Same way with functions : abs(cos(x))-cos(x) or abs(sin(x))-sin(x) or abs(sqrt(x))-sqrt(x) for x = symbols('x', real=True)

But if I try : limit(abs(ln(x))-ln(x), x, a, '-') with a = symbols('a', real=True), it returns (sign(log(a)) - 1)*log(a). Idem for the direction '+' and without direction.

Sergey Kirpichev

unread,
Dec 14, 2015, 12:44:36 PM12/14/15
to sympy
On Thursday, February 12, 2015 at 10:26:32 PM UTC+3, Arnaud Usciati wrote:
Maybe abs() function have to be reconsidered, because I found other issues with abs...

All examples above are solved with patch from
 https://github.com/skirpichev/omg/pull/82
(on top of the https://github.com/skirpichev/omg/pull/154)
That should work for sympy with trivial replacements (is_extended_real -> is_real).

limit(abs(ln(x))-ln(x), x, 2) or limit(abs(ln(x))-ln(x), x, 2, '+') return 0 (OK), but limit(abs(ln(x))-ln(x), x, 2, '-') runs endless and I need to interrupt it to stop calculating.. Same way with functions : abs(cos(x))-cos(x) or abs(sin(x))-sin(x) or abs(sqrt(x))-sqrt(x) for x = symbols('x', real=True)

The problem is that nseries constantly emits an Order term and lseries can't yield anything at all.  But for real,
positive _and finite_ x < 1: abs(ln(2-x))-ln(2-x) == 0.

But if I try : limit(abs(ln(x))-ln(x), x, a, '-') with a = symbols('a', real=True), it returns (sign(log(a)) - 1)*log(a). Idem for the direction '+' and without direction.

This is an example of lucky answer, due to a non-strict approach in the calculate_series routine to
the zero-decision problem.  I.e. if sympy can't simplify term to zero, it thinks term is nonzero.

Wrong idea in general, but in this particular case it happens to be right.
Reply all
Reply to author
Forward
0 new messages