Ask Your Question
0

Redundant assumptions

asked 2024-11-26 04:17:05 +0100

Jidong gravatar image

updated 2024-11-26 04:53:48 +0100

I want to verify certain inequalities involving real numbers and infinity. One case is showing certain expression is less than infinity. However, the following situation really puzzles me:

a = SR.var('a')
bool(a < infinity)

It returns 'False'. But when I do

assume(a < infinity)

It says

ValueError: Assumption is redundant

Why is this the case and how should I get 'True' for 'bool(a < infinity)'?

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2024-11-26 16:57:31 +0100

Emmanuel Charpentier gravatar image

"When all else fails, RTFM..."

sage: x.is_infinity?
Docstring:     
   Return "True" if "self" is an infinite expression.

   EXAMPLES:

      sage: SR(oo).is_infinity()
      True
      sage: x.is_infinity()
      False
Init docstring: Initialize self.  See help(type(self)) for accurate signature.
File:           /usr/local/sage-10/src/sage/symbolic/expression.pyx
Type:           builtin_function_or_method

Illustration :

sage: foo=(1/x).limit(x=0)
sage: foo.is_infinity()
True

Note that :

sage: bool(foo>0)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[7], line 1
----> 1 bool(foo>Integer(0))

File /usr/local/sage-10/src/sage/symbolic/expression.pyx:3453, in sage.symbolic.expression.Expression.__bool__()
   3451 pynac_result = decide_relational(self._gobj)
   3452 if pynac_result == relational_undecidable:
-> 3453     raise ValueError('undecidable relation: ' + repr(self))
   3454 
   3455 # pynac is guaranteed to give the correct answer for comparing infinities

ValueError: undecidable relation: Infinity > 0

HTH,

edit flag offensive delete link more

Comments

Thanks! That is interesting. If I do

bool(infinity > 0)

It returns 'True'. Why is this not contradicting to the ValueError in your example?

Jidong gravatar imageJidong ( 2024-11-26 17:44:58 +0100 )edit

Why is this not contradicting to the ValueError in your example?

Multiple synonyms to the same quantity :

sage: infinity is Infinity
True
sage: Infinity is +Infinity
True

BTW :

sage: foo=(1/x).limit(x=0)
sage: foo is infinity
False
sage: foo is Infinity
False
sage: foo is +Infinity
False

and, furthermore

sage: bool(foo==infinity)
False
sage: bool(foo==Infinity)
False
sage: bool(foo==+Infinity)
False

HTH,

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2024-11-27 09:15:33 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2024-11-26 04:17:05 +0100

Seen: 108 times

Last updated: Nov 26