On Oct 3, 2009, at 4:08 PM, rjf wrote:

> Then would factoring 2*x-2  also reveal the bug?  Or maybe factoring
> 2 ?

Nope.

> It seems to me that for Pari to remove and then ignore the content  
> (in Z?) is a bug.

Yep, I consider that strange too (though it does solve the "more  
interesting" problem). Right in the users manual it states

Note that PARI tries to guess in a sensible way over which ring you  
want to factor. Note
also that factorization of polynomials is done up to multiplication  
by a constant. In particular, the
factors of rational polynomials will have integer coefficients, and  
the content of a polynomial or
rational function is discarded and not included in the factorization.  
If you need it, you can always
ask for the content explicitly.

And trying it out:

                   GP/PARI CALCULATOR Version 2.3.3 (released)
            i386 running darwin (ix86/GMP-4.2.1 kernel) 32-bit version
        compiled: Sep  9 2009, gcc-4.0.1 (Apple Computer, Inc. build  
5363)
                 (readline v5.2 enabled, extended help available)

                      Copyright (C) 2000-2006 The PARI Group

? factor(15*x+3)
%7 =
[5*x + 1 1]

? factor(15.0*x+3)
%8 =
[x + 0.2000000000000000000000000000 1]

That's why we "fix" the result when we get it back from Pari (though,  
up till now, a corner case was broken).

> It would make some sense to optionally not factor such a content
> unless you want to also do integer factorization.

I agree, though that's a much smaller issue.

- Robert

>
>
>
>
>
> On Oct 3, 11:51 am, Robert Bradshaw <rober...@math.washington.edu>
> wrote:
>> On Oct 2, 2009, at 9:30 PM, rjf wrote:
>>
>>> hey, factoring-testing guys..
>>> If you make up factoring problems this way, you are probably not  
>>> doing
>>> much testing of the real factoring algorithms.
>>
>> Actually, given this bug has been in Sage for so long, the real issue
>> is that for several years no one had tested "easy" factorizations
>> such as this--everyone was worried about timing and testing the
>> "hard" ones.
>>
>>
>>
>>> Repeated factors like
>>> this of different degree are detected by so-called square-free
>>> factorization.
>>> The time to factor F in Maxima is, to the resolution of the clock,
>>> 0.0000 seconds on
>>> a 3GHz Intel machine.
>>
>>> F can also be entirely factored by the sqfr program, which uses a 5
>>> line program involving
>>> differentiation, GCD, and division.  So the problem is  
>>> essentially no
>>> harder than factoring f and g separately.
>>
>>> There are papers that show how to construct polynomials that are
>>> difficult to factor.
>>
>>> I dunno about the Sage wrapper problem.  If that's the difficulty,
>>> maybe the subject line is wrong.
>>
>> Yes, it was all about the wrapper (pari ignores the content, and
>> there was a bug in reconstructing it). The subject perfectly
>> describes the symptom, and was helpful in locating the cause.
>>
>> - Robert
> >


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to