This is because I currently lives in the (inexact) field of complex  
numbers. This will change. Joel Mohler is currently doing a lot of  
work on implementing number fields right now, so hopefully this will  
work in the near future. If you were interested in working on it you  
might want to see what he's done so far.

- Robert

On Mar 31, 2007, at 7:10 AM, Pablo De Napoli wrote:

> Hi,
>
> I want to ask you some questions concerning the arithmetic of number
> fields in Sage.
>
> Does Sage currently support factoring in Gaussian integers (i.e. in  
> the ring
> Z[I] of complex numbers with integral real/imaginary parts)?
> I thing this would be a nice feature to have.
>
> In pari/gp for example this works:
>
> ? factor(5*I)
> %1 =
> [2 + I 1]
>
> [1 + 2*I 1]
>
> in sage
>
> factor(5*I)
> gives an error.
>
> Obviously factoring depends on the ring in which we are working on,
> so that for example the factorization of 5 would be different in  
> the ring
> Z  or in the ring Z[I]
>
> Currently Z[I] seems not to be a supported ring in sage, even though
> you can create a quadratic field
>
> F=QuadraticFiled(-1,'a')
> (number field in a with defining polynomial x^2+1)
>
> and after doing
> a= F.gen()
>
> 'a' behaves algebraically as the complex number I (i.e. a^2=-1)
> [ Mathematically 'a' is not the complex number 'I', as it could be  
> also the complex
> number '-I' wich is also a root of  the same minimal polynomial x^2 
> +1 ;
> however there exists the function complex_imbedding() that
> gives the corresponding complex number:
>
> sage: a.complex_embedding ()
> 1.00000000000000*I
>
> assuming that a=I)
>
> but there seems to be no implementation of factorization in
> quadratic fields (of course in those fields in wich  there is a unique
> decomposition into primes), nor a notion of the subring of
> algebraic integers.
>
>  My question is: what would be the best way to implement this?
>
> Perphaps the best way would be creating a new
> ring sage.ring.complex_integer representing gaussian_integers
> for representing Gaussian integers
>
> I see that currently a complex number like
>
> 2+3*I
>
> is represented in sage, by using float point representation.
>
> z=2+3*I
> sage: type(z)
> <type 'sage.rings.complex_number.ComplexNumber' >
> sage: z.real()
> 2.00000000000000
> sage: type(z.real())
> <type 'sage.rings.real_mpfr.RealNumber'>
> sage:
>
> and this could lead to rounding errors. It would be better to do
> exact integer arithmetic, when dealing with Gaussian integers.
>
> best
> regards
>
> Pablo
>
> >


--~--~---------~--~----~------------~-------~--~----~
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://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to