On Thu, Jun 30, 2011 at 5:57 PM, Francois Bissey
<[email protected]> wrote:
>> Looking deeper, I think the problem might be with
>> S.NegativeInfinity._sage_:
>>
>> In [48]: source((-oo)._sage_)
>> In file: ./sympy/core/numbers.py
>>     def _sage_(self):
>>         import sage.all as sage
>>         #XXX: fixme, this should work:
>>         #return sage.Integer(self[0])/sage.Integer(self[1])
>>         return sage.Integer(self.p)/sage.Integer(self.q)
>>
>> But oo._sage_ (assumedly) does the right thing:
>>
>> In [49]: source(oo._sage_)
>> In file: ./sympy/core/numbers.py
>>     def _sage_(self):
>>         import sage.all as sage
>>         return sage.oo
>>
>> I'm not sure why the former does not just return -sage.oo.  Anyway, I
>> bet if you patch the SymPy code to do that, it will work (let us know
>> if it does, so we can fix it here too).
>>
> I think I found it:
> class Infinity(RationalConstant):
>     __metaclass__ = Singleton
>
> defines
>     def _sage_(self):
>         import sage.all as sage
>         return sage.oo
>
> But:
> class NegativeInfinity(RationalConstant):
>     __metaclass__ = Singleton
>
> doesn't have an equivalent statement for _sage_ so I guess this bit is used:
>     p = -1
>     q = 0
>
> I'll add a sage bit in there and see if it fixes the problem.
>
> Francois

Oh, you're right.  That first code snippet is Rational._sage_.  So
yes, you should just define NegativeInfinity._sage_, and it should
hopefully work.

Aaron Meurer

>
> This email may be confidential and subject to legal privilege, it may
> not reflect the views of the University of Canterbury, and it is not
> guaranteed to be virus free. If you are not an intended recipient,
> please notify the sender immediately and erase all copies of the message
> and any attachments.
>
> Please refer to http://www.canterbury.ac.nz/emaildisclaimer for more
> information.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to