On Saturday 01 November 2008, mmarco wrote:
> I agree that, when it is possible, it is better to work in exact
> rings. But sometimes (not in this particular example, but in other
> similar ones) you actually need to use complex numbers. I guess there
> is a way to do it in an alggebraic extension of Q, but i am not sure
> how to handle that with sage.

Here is how to construct polynomial rings over absolute number fields.

sage: P.<x> = PolynomialRing(QQ)
sage: K.<i> = NumberField(x^2 + 1)
sage: i
i
sage: i^2
-1
sage: P.<x,y,z> = PolynomialRing(K)
sage: I = sage.rings.ideal.Katsura(P)
sage: J = Ideal(i*f for f in I.gens())
sage: J.groebner_basis()
[x + 2*y + 2*z - 1, y*z + 6/5*z^2 - 1/10*y - 2/5*z, y^2 - 3/5*z^2 - 1/5*y + 
1/5*z, z^3 - 79/210*z^2 + 1/30*y + 1/70*z]

sage: %timeit x*y
1000000 loops, best of 3: 343 ns per loop

Note that if you choose the complex numbers as base field a generic much 
slower polynomial implementation is chosen.

sage: P.<x,y,z> = PolynomialRing(CC)
sage: %timeit x*y
100000 loops, best of 3: 11.7 µs per loop



-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: [EMAIL PROTECTED]


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@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-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to