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)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/grout/sage/devel/sage-main/sage/plot/<ipython console> in <module>()
/home/grout/sage/devel/sage-main/sage/plot/element.pyx in
sage.structure.element.ModuleElement.__add__
(sage/structure/element.c:5748)()
/home/grout/sage/devel/sage-main/sage/plot/coerce.pyx in
sage.structure.coerce.CoercionModel_cache_maps.bin_op
(sage/structure/coerce.c:6364)()
TypeError: unsupported operand parent(s) for '+': 'Symbolic Ring' and
'<type 'long'>'
Jason
What's the rule about whose is a dupe then? I posted on sage-support
first, but you hit "new ticket" first. I'll let you have the ticket; please
mark mine a dupe.
William
Gee, Bob, we're falling all over ourselves trying to rush to help you!
Welcome again to the community.
Jason
Yeah, I paused long enough to write a patch. I guess this is a good
kind of problem to have :).
- Robert
>
> What's the rule about whose is a dupe then? I posted on sage-support
> first, but you hit "new ticket" first. I'll let you have the ticket; please
> mark mine a dupe.
Hehe...I believe it's the "Code talks" rule. Robert has a patch up
already :).
Jason