On Mon, Sep 22, 2008 at 6:04 PM, Jason Grout
<[EMAIL PROTECTED]> wrote:
>
> Bob Wonderly wrote:
>> Using Sage I solved a long list of equations and put the solutions (s)
>> in a list; e.g.:
>>
>> sage: for j in range(52,54,1):
>>      q = slst[j]
>>      j=q[0]; k=(q[1]); s=(q[2])
>>      (q,j,k,s)
>> .....:
>> ([52, 30, 2081203288L], 52, 30, 2081203288L)
>> ([53, 53, 17903198518682712L], 53, 53, 17903198518682712L)
>>
>> Now I want to plug j and s into the list of y equations so that I can do
>> further calculations involving i. But Sage appears to be getting hung on
>> the s being long:
>>
>> sage: for j in range(52,54,1):
>>      q = slst[j]
>>      j=q[0]; k=(q[1]); s=(q[2])
>>      y = 2*(2**k)*i + s
>>      (j,k,s,y)
>> .....:
>> ....
>> ....
>> TypeError: unsupported operand parent(s) for '+': 'Symbolic Ring' and
>> '<type 'long'>'
>>
>> When I take the s out of the equation for y it's OK:
>>
>> sage: for j in range(52,54,1):
>>      q = slst[j]
>>      j=q[0]; k=(q[1]); s=(q[2])
>>      y = 2*(2**k)*i
>>      (j,k,s,y)
>> .....:
>> (52, 30, 2081203288L, 2147483648*i)
>> (53, 53, 17903198518682712L, 18014398509481984*i)
>>
>> FWIW:
>>
>> sage: type(j), type(k), type(s), type(y), type(i)
>>
>>
>> (<type 'int'>,
>>   <type 'int'>,
>>   <type 'long'>,
>>   <class 'sage.calculus.calculus.SymbolicArithmetic'>,
>>   <class 'sage.calculus.calculus.SymbolicVariable'>)
>>
>> None of the tricks I tried have convinced Sage and y that s is OK.
>
>
> Can you try converting s to an element that Sage knows by saying:
>
> y = 2*(2**k)*i + Integer(s)
>
> That said, I reproduced your error with just:
>
> sage: var("b")+long(2)

This is a bug, so I've added it to trac:

http://trac.sagemath.org/sage_trac/ticket/4171

William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to