Expressions Involving Infinity

48 views
Skip to first unread message

Gaurav Dhingra

unread,
May 17, 2015, 3:13:59 AM5/17/15
to sy...@googlegroups.com
>>> from sympy import Symbol, oo, simplify
>>> x = Symbol('x', real=True)
>>> simplify( x*oo )
oo*x

Do we use extended real number system(Affinely Extended Real Number System) in sympy ?
If we do use them, then why not expressions like these  "x*oo" evaluated to a Piecewise function like 
>>> Symbol('x')
>>> simplify( x*oo )
Piecewise( ( -oo, x< 0 ), ( oo, x > 0), (Nan, x==0 ))       # i expect this to happen.

Gaurav Dhingra

Christophe Bal

unread,
May 17, 2015, 5:01:53 AM5/17/15
to sympy-list
Hello.

I think that the 2nd writing will be hard to handle in more complex calculus. Maybe the three possibilities should be available if an assumption is made on x.


A simple user.


Christophe BAL
Enseignant de mathématiques en Lycée et développeur Python amateur
---
French math teacher in a "Lycée" and Python amateur developer

--
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/33347c95-dba2-47a5-99f1-b8d7cbdd3c59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gaurav Dhingra

unread,
May 17, 2015, 8:29:57 AM5/17/15
to sy...@googlegroups.com


On Sunday, May 17, 2015 at 12:43:59 PM UTC+5:30, Gaurav Dhingra wrote:
>>> from sympy import Symbol, oo, simplify
>>> x = Symbol('x', real=True)
>>> simplify( x*oo )
oo*x

Do we use extended real number system(Affinely Extended Real Number System) in sympy ?
If we do use them, then why not expressions like these  "x*oo" evaluated to a Piecewise function like 
>>> Symbol('x', real=True)
>>> simplify( x*oo )
Piecewise( ( -oo, x< 0 ), ( oo, x > 0), (Nan, x==0 ))       # i expect this to happen.
 
Edit: I have  2nd writing of x to 'real=True'

Gaurav Dhingra

Gaurav Dhingra

unread,
May 17, 2015, 8:32:00 AM5/17/15
to sy...@googlegroups.com
Actually that was a mistake i made in writing the 2nd one.

AMiT Kumar

unread,
May 19, 2015, 7:03:06 AM5/19/15
to sy...@googlegroups.com
As far as I know, I don't think we deal with Extended
Real Number System, probably that's not documented
as well.

For instance:

In [4]: solve(x <= oo)
Out[4]: And(-oo < x, x < oo)


I think we need to wait for our assumption system to
become more mature before completely supporting
Extended Real system.

AMiT Kumar
Delhi Technological University

On Sunday, May 17, 2015 at 12:43:59 PM UTC+5:30, Gaurav Dhingra wrote:

Aaron Meurer

unread,
May 19, 2015, 12:06:30 PM5/19/15
to sy...@googlegroups.com
x is generally assumed to be complex (not real, so your Piecewise is
not really correct). Hence it could also be I*oo or -I*oo or even zoo.
x*oo is the simplest form of this. Plus, it's best to minimize
automatic simplification, and especially avoid automatic
"simplification" that actually makes the expression more complex (like
your Piecewise).

Aaron Meurer

Gaurav Dhingra

unread,
May 21, 2015, 8:08:44 AM5/21/15
to sy...@googlegroups.com
Sorry for late reply. However i had mentioned in my second post as an edit that 'x' is with assumption 'real=True'.
But i now understand that  "operation i suggested" makes the expression more of complex. Rather than simplifying it.
Reply all
Reply to author
Forward
0 new messages