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
I get a nostalgic feeling. Implementing this was the very first patch I
ever made for Sage... an "exercise" by John Cremona.
From http://sagemath.org/src-old/, it was released on Christmas Eve, 2009.
Jason
> 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.
-----------
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