# Existence of a limit

How does one (i.e. automatically in an own program) recognize existence of a limit?

So far I've discovered that -oo, oo, ind, und cause the non-existence, I just dunno how to test these "values". Obvious

if limit(f, x=oo, dir='+') == und:
...


does not work...

Sage 5.1 Kubuntu 12.04

edit retag close merge delete

Sort by » oldest newest most voted

Hi as far as I understand the problem is that oo so on are symbolic expressios. If you try to compare them with == sage returns as a new symbolic expression the symbolic equationion:

var('x,y')
print x==y
print type(x==y)


returns

x == y
<type 'sage.symbolic.expression.Expression'>


A soultion seems to be to cast the symbolic equation to a boolean:

print bool(x==y)
print bool(x==x)


which returns

False
True

more

1

Unfortunately, ind is unknown to sage for some reason: sage: bool( lim(sin(x), x=oo) == ind) --------------------------------------------------------------------------- NameError Traceback (most recent call last) NameError: name 'ind' is not defined

I dont know if this is the correct way to fix this problem (I'm also no expert with these symbolic expression) but print bool(SR('ind')==limit(sin(x),x=oo)) Seems to solve the problem for me.

Hmm, that's true. We allow it as a result from Maxima for e.g. lim(sin(1/x),x=0) or your example, but I guess we just print it out. I've made this http://trac.sagemath.org/sage_trac/ticket/13269, though I'm not sure what exactly could be done.

@Tobias; that doesn't really solve the problem, though it probably is good enough for some of the checking purposes.