On Tuesday, May 12, 2015 at 7:25:41 AM UTC-7, N. Du Hamel wrote:
>
> Hi everyone,
>
> I want a symbolic square root of a resultant of two polynomials and I get 
> a Taylor expansion in the complex numbers.
>
> That's not what I wanted, I just need a symbolic expression S for which we 
> have the equality S^2 = -G.resultant(H)
>

The object you're getting is not what it seems:

sage: r=G.resultant(H)
sage: r.operator()
sage: r.operands()
[]
sage: type(r.pyobject())
<type 'sage.libs.pari.gen.gen'>

What happened is that the resultant computation was shipped off to pari and 
when it came back, it was "converted" back into SR. However, sage doesn't 
actually know an intelligent way of coercing pari objects into SR, so it 
just gets wrapped into SR as an "arithmetic constant": a python object that 
has arithmetic operations defined for it. As a result, "sqrt" on it is just 
the pari "sqrt", which apparently makes a series expansion. In order to 
make the object useful, you really need to ensure the object is properly 
created:

sage: -r
-g1^2 + (2*g3 - g2^2)*g1 - g3^2
sage: sqrt(-g1^2 + (2*g3 - g2^2)*g1 - g3^2)
sqrt(-(g2^2 - 2*g3)*g1 - g1^2 - g3^2)

It's just a bug that pari->SR conversion fails (silently!) to do what it 
should. The reason is that you're hitting code that is not intended to be 
used over SR (and the code should probably give you an error when you're 
trying to use it) We should really just have a resultant routine straight 
on SR, for those cases where you really need to do something with SR.

Workaround:

sage: R.<g1,g2,g3,X>=QQ[]
sage: G = X^2+g1
sage: H = X^2+g2*X+g3
sage: G.resultant(H,X)
g1*g2^2 + g1^2 - 2*g1*g3 + g3^2
sage: sqrt(SR(-G.resultant(H,X)))
sqrt(-g1*g2^2 - g1^2 + 2*g1*g3 - g3^2)

(you should probably just work with the resultant, since wrapping it in a 
"sqrt" symbol is not going to help you much. Then you don't need SR at all, 
and that's usually a good thing)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to