Thanks for the suggestion Jeroen. I tried this but I also need the
indeterminate q to be invertible. I have ended up using he following:
R=LaurentPolynomialRing(IntegerRing(),'q')
q=R.gen()
self._quantum_integer={0:0, 1:1} # dictionary of positive quantum
integers
self._quantum_integer_root={0:0, 1:1} # dictionary of square roots of
positive quantum integers
qint=1
x=polygen(R)
for k in range(1,shape.size()):
qint+=q**(2*k) # now equal to 1+q^2+...+q^2k
= [k+1]_{q^2}
R=R.extension(x**2-qint,'r%d'%(k+1))
self._quantum_integer[k+1]=qint # we remember these because we
nee them later
self._quantum_integer_root[k+1]=R.gen()
R=R.extension(x**2+1,'I')
I=R.gen();
F=FractionField_generic(R) # the FractionField is not implemented so
we hack
R.__fraction_field=F
which seems to work and not be too slow. The hack at the bottom to create
the field of fractions is necessary because extensions don't know that they
are PIDs (of course, they aren't always, although they are in this case).
Andrew
On Thursday, 9 October 2014 20:33:20 UTC+11, Jeroen Demeyer wrote:
>
> On 2014-10-09 10:31, Andrew wrote:
> > sage:R.<q>=PolynomialRing(QQ)
> > sage:s3=(1+q+q^2).sqrt(name='s3')
> > sage:s4=(1+q+q^2+q^3).sqrt(name='s4')
> > sage:s3*s4 # this blows up:(
>
> If you don't mind approximations, you could consider using
> PowerSeriesRing(QQ) instead. There, every polynomial with constant
> coefficient 1 has a square root.
>
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.