factoring in a number field

15 views
Skip to first unread message

Joel B. Mohler

unread,
Feb 26, 2012, 7:35:09 PM2/26/12
to sage-support
After having been a heavy sage user for several years, I now have
virtually not touched it for several more years. Returning now on a
lark, I'm feeling rather confused because I'd think the following
would obviously work. My goal is to factor a bunch of Gaussian
integers.

sage: K.<I>=QuadraticField(-1)
sage: ((I+1)*(I+1)).factor()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call
last)
/home/joel/.sagelocalrc.py in <module>()
AttributeError: 'sage.rings.number_field.number_field_element_quadr'
object has no attribute 'factor'

Isn't factoring a Gaussian integer about the simplest complex number
theory one might wish to try? And isn't this the most obvious way to
try it?

Joel

D. S. McNeil

unread,
Feb 26, 2012, 7:58:17 PM2/26/12
to sage-s...@googlegroups.com
> sage: K.<I>=QuadraticField(-1)
> sage: ((I+1)*(I+1)).factor()

This may have been fixed since the last time you looked at Sage: what
version are you running? It seems to work for me in both 4.8 and 5.0
beta.

sage: K.<I>=QuadraticField(-1)
sage: ((I+1)*(I+1))

2*I
sage: ((I+1)*(I+1)).factor()
(I + 1)^2


Doug

Joel B. Mohler

unread,
Feb 26, 2012, 7:59:46 PM2/26/12
to sage-support
On Feb 26, 7:35 pm, "Joel B. Mohler" <j...@kiwistrawberry.us> wrote:
> After having been a heavy sage user for several years, I now have
> virtually not touched it for several more years.  Returning now on a
> lark, I'm feeling rather confused because I'd think the following
> would obviously work.  My goal is to factor a bunch of Gaussian
> integers.
>
> sage: K.<I>=QuadraticField(-1)
> sage: ((I+1)*(I+1)).factor()
> ---------------------------------------------------------------------------
> AttributeError                            Traceback (most recent call
> last)
> /home/joel/.sagelocalrc.py in <module>()
> AttributeError: 'sage.rings.number_field.number_field_element_quadr'
> object has no attribute 'factor'

Ok, to answer myself, this appears to work in the cell server on the
sage front page, but does not work in my old install of version 4.3.
Therefore I conclude that I need to upgrade. However, I'm still quite
baffled that this didn't work in sage 4.3.

Joel

William Stein

unread,
Feb 26, 2012, 8:13:17 PM2/26/12
to sage-s...@googlegroups.com
Um, isn't sage 4.3 ancient?  

> Joel
>
> --
> To post to this group, send email to sage-s...@googlegroups.com
> To unsubscribe from this group, send email to sage-support...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>

--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

Jeroen Demeyer

unread,
Feb 27, 2012, 4:06:34 AM2/27/12
to sage-s...@googlegroups.com

I get a nostalgic feeling. Implementing this was the very first patch I
ever made for Sage... an "exercise" by John Cremona.

Jason Grout

unread,
Feb 27, 2012, 9:31:05 AM2/27/12
to sage-s...@googlegroups.com
On 2/26/12 7:13 PM, William Stein wrote:
> Um, isn't sage 4.3 ancient?

From http://sagemath.org/src-old/, it was released on Christmas Eve, 2009.

Jason

Justin C. Walker

unread,
Feb 27, 2012, 3:59:07 PM2/27/12
to sage-s...@googlegroups.com

On Feb 26, 2012, at 17:13 , William Stein wrote:

> On Sunday, February 26, 2012, Joel B. Mohler <jo...@kiwistrawberry.us> wrote:
>> On Feb 26, 7:35 pm, "Joel B. Mohler" <j...@kiwistrawberry.us> wrote:
>>> After having been a heavy sage user for several years, I now have
>>> virtually not touched it for several more years. Returning now on a
>>> lark, I'm feeling rather confused because I'd think the following
>>> would obviously work. My goal is to factor a bunch of Gaussian
>>> integers.
>>>
>>> sage: K.<I>=QuadraticField(-1)
>>> sage: ((I+1)*(I+1)).factor()
>>>
> ---------------------------------------------------------------------------
>>> AttributeError Traceback (most recent call
>>> last)
>>> /home/joel/.sagelocalrc.py in <module>()
>>> AttributeError: 'sage.rings.number_field.number_field_element_quadr'
>>> object has no attribute 'factor'
>>
>> Ok, to answer myself, this appears to work in the cell server on the
>> sage front page, but does not work in my old install of version 4.3.
>> Therefore I conclude that I need to upgrade. However, I'm still quite
>> baffled that this didn't work in sage 4.3.
>>
>
> Um, isn't sage 4.3 ancient?

December, 2009. I think this was fixed in 4.5.3.

Justin

--
Justin C. Walker, Curmudgeon at Large
Institute for the Absorption of Federal Funds
-----------
I'm beginning to like the cut of his jibberish.
-----------

William Stein

unread,
Feb 27, 2012, 4:05:04 PM2/27/12
to sage-s...@googlegroups.com

Any serious number theorist (i.e., most Sage users who would want to
do this sort of thing before 2009?) would have just done:

sage: K.<I>=QuadraticField(-1)
sage: a = K.ideal( ((I+1)*(I+1)))
sage: a.factor()
(Fractional ideal (I + 1))^2

Reply all
Reply to author
Forward
0 new messages