Difference between expr.is_number and expr.is_Number

47 views
Skip to first unread message

Paul Royik

unread,
Mar 25, 2015, 8:32:17 AM3/25/15
to sy...@googlegroups.com
What is the difference between above two properties?

Aaron Meurer

unread,
Mar 25, 2015, 12:55:53 PM3/25/15
to sy...@googlegroups.com
The capitalized version checks if the class is an instance of the
Number class (this is true in general for is_Capitalized). The
lowercase version checks if the expression has free symbols. So for
instance, (1 + pi).is_number is True but (1 + pi).is_Number is False.
In general, is_lowercase means it checks some assumption on an
expression (is_number is technically not part of the assumptions
system, but it is very similar).

Aaron Meurer

On Wed, Mar 25, 2015 at 7:32 AM, Paul Royik <distan...@gmail.com> wrote:
> What is the difference between above two properties?
>
> --
> 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/bece1b16-7060-44b0-b3b5-932fec144f4a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Paul Royik

unread,
Mar 25, 2015, 1:46:43 PM3/25/15
to sy...@googlegroups.com
Thank you.
Can you tell me what pi is instance of?

Sudhanshu Mishra

unread,
Mar 25, 2015, 2:13:00 PM3/25/15
to sy...@googlegroups.com
In [24]: pi.is_NumberSymbol
Out[24]: True

pi is not an object of Number class though.

Sudhanshu Mishra

Paul Royik

unread,
Mar 25, 2015, 3:58:10 PM3/25/15
to sy...@googlegroups.com
Thanks.

Aaron Meurer

unread,
Mar 25, 2015, 4:58:22 PM3/25/15
to sy...@googlegroups.com
I believe the Number class is only for explicit integer, rational, and
floating point numbers.

Aaron Meurer
> https://groups.google.com/d/msgid/sympy/91cfdcae-fda6-4d30-87d7-30189ff74c2a%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages