Andrew,

Read up on resultants:

sage: R.<a1,a2,b1,b2,x,y>=QQ[]
sage: f=x^2+a1*x+a2
sage: g=x^2+b1*x+b2
sage: f(x=y).resultant(g(x=x-y),variable=y)
a1^2*b1*x + a1*b1^2*x + a1^2*x^2 + 3*a1*b1*x^2 + b1^2*x^2 + 2*a1*x^3 +
2*b1*x^3 + x^4 + a1*a2*b1 + a2*b1^2 + a1^2*b2 + a1*b1*b2 + 2*a1*a2*x +
2*a2*b1*x + 2*a1*b2*x + 2*b1*b2*x + 2*a2*x^2 + 2*b2*x^2 + a2^2 -
2*a2*b2 + b2^2
sage: f(x=y).resultant(g(x=x+y),variable=y)
a1^2*b1*x - a1*b1^2*x + a1^2*x^2 - 3*a1*b1*x^2 + b1^2*x^2 - 2*a1*x^3 +
2*b1*x^3 + x^4 - a1*a2*b1 + a2*b1^2 + a1^2*b2 - a1*b1*b2 - 2*a1*a2*x +
2*a2*b1*x - 2*a1*b2*x + 2*b1*b2*x + 2*a2*x^2 + 2*b2*x^2 + a2^2 -
2*a2*b2 + b2^2

The last two results are what you want (roots alpha+beta, resp. alpha-
beta).

John Cremona


On Oct 24, 6:23 pm, andrew ewart <aewartma...@googlemail.com> wrote:
> is there a way of doing what uve done except considering the pair of
> polynomials
> x^2+a1*x+a0
> x^2+b1*x+b0
> where a0,a1,b0,b1 lie in QQ but their exact values r not known
> and al is a root of the first and be is a root of the second?
>
>
>
>
>
>
>
> On Sun, Oct 24, 2010 at 5:22 PM, Yann <yannlaiglecha...@gmail.com> wrote:
> > On Oct 23, 9:39 pm, andrew ewart <aewartma...@googlemail.com> wrote:
> > > if alpha is a root of x^2+a_1*x+a_0 and beta is a root of x^2+b_1*x
> > > +b_0 (both polynomials r in QQ), then how do i construct code such
> > > that it can tell me the minimum polynomials of the following roots
> > > alpha+beta
> > > and
> > > alpha*beta
>
> > Hi, I'm not sure if I understood your question, but this might be what
> > you want:
>
> > sage: R.<x> = QQbar[]
> > sage: p = 1/7*x^2-x+4
> > sage: q = x^2+x+1/3
> > sage: p.roots()
> > [(3.500000000000000? - 3.968626966596886?*I, 1), (3.500000000000000? +
> > 3.968626966596886?*I, 1)]
> > sage: a = p.roots()[0][0]
> > sage: b = q.roots()[0][0]
> > sage: (a+b).minpoly()
> > x^4 - 12*x^3 + 257/3*x^2 - 298*x + 5503/9
> > sage: (a*b).minpoly()
> > x^4 + 7*x^3 + 77/3*x^2 + 196/3*x + 784/9
>
> > I hope this helps.
>
> >      Yann
>
> > --
> > To post to this group, send email to sage-support@googlegroups.com
> > To unsubscribe from this group, send email to
> > sage-support+unsubscr...@googlegroups.com<sage-support%2bunsubscr...@google 
> > groups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/sage-support
> > URL:http://www.sagemath.org

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

Reply via email to