       Re: A question about algebraic numbers using Mathematica

• To: mathgroup at smc.vnet.net
• Subject: [mg62798] Re: [mg62762] A question about algebraic numbers using Mathematica
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Mon, 5 Dec 2005 13:41:02 -0500 (EST)
• References: <869C3FFA9CA97944A4EEF55353DE74245D4B91@ST-EXCL05.statoil.net>
• Sender: owner-wri-mathgroup at wolfram.com

```On 5 Dec 2005, at 23:38, Kent Holing wrote:

>  thanks
> What about the following (I have thought more about the question)?
> Since in my case of interest the quartic q(x) and 2-x are irreducible
> over Q we must have that GCD[q(x),2-x] = 1 so  there exist
> polynomials u
> and v such that u q + v (2-x) = 1.
> Since u is constant (the degree of u < the degree 2-x) and q(r) = 0 we
> have that v(2-r) = 1, so
> v is the inverse of 2-r in Q[r]. Is this an easier way of determing
> the
> inverse of 2-r?
> By the way, could you provide me with the inverse of 2c-r?

Yes, you are right of course, but I think you would want Mathematica
do this for you?  Mathematica has a function PolynomialExtendedGCD in
the package Algebra`PolynomialExtendedGCD` and this function will do
exactly what you need when a,b and c are integers but will not work
with symbols. So although mathematically your argument is correct, I
do not think Mathematica can be of help in this.
As for your last question, I think it can be done in the same way.
Here are all the steps again:

First define the polynomial:
In:=
poly = r^4 - 2*c*r^3 + (c^2 - 2*a^2)*r^2 + 2*a^2*c*r -
a^2*c^2;

Next find the polynomial poly1 satisfied by (2c -r):

In:=
poly1 = First[GroebnerBasis[{poly, v - (2*c - r)},
{a, b, c, v}, {r}]]

Out=
4*c^4 - 12*v*c^3 - 5*a^2*c^2 + 13*v^2*c^2 - 6*v^3*c +
6*a^2*v*c + v^4 - 2*a^2*v^2

Next find the part free of v:

In:=
free = poly1 /. v -> 0

Out=
4*c^4 - 5*a^2*c^2

The polynomial q below is our inverse:

In:=
poly2 = Cancel[(poly1 - free)/v]

Out=
-12*c^3 + 13*v*c^2 + 6*a^2*c - 6*v^2*c + v^3 - 2*a^2*v

In:=
q = Expand[poly2 /. v -> 2*c - r]/free

Out=
(-2*c^3 - r*c^2 + 2*a^2*c - r^3 + 2*a^2*r)/
(4*c^4 - 5*a^2*c^2)

Finally, we check that it really is the inverse, that is, that q*(2c -
r) gives remainder 1 on division by poly:

In:=
FullSimplify[PolynomialReduce[q*(2*c - r), poly, r]]

Out=
{{1/(c^2*(4*c^2 - 5*a^2))}, -1}

Somehow I got -1 so the inverse is actually -q.  (However as it is
already after midnight here I shall leave it at that).

Andrzej Kozlowski

>
> -----Original Message-----
> From: Andrzej Kozlowski [mailto:akoz at mimuw.edu.pl]
To: mathgroup at smc.vnet.net
> Sent: 5. desember 2005 15:25
> To: Kent Holing
> Subject: [mg62798] Re: [mg62762] A question about algebraic numbers using
> Mathematica
>
>
> On 5 Dec 2005, at 17:37, Kent Holing wrote:
>
>> I want to find the inverse of 2 - r in Q[r] where r is a root of the
>> equation
>> x^4 - 2c x^3 + (c^2 - 2a^2) x^2 + 2a^2 c x - a^2 c^2 = 0 for a, b and
>> c integers.
>>
>> Can this be done for general a, b and c? (I know how to do it for
>> specific given numerical values of a, b and c.)
>>
>> Kent Holing
>>
>
>
> I think this can be done using Groebner basis. Suppose r satisfies the
> above equation and let v be 2-r. Let us first find the algebraic
> equation satisfied by v.
>
> In:=
> poly1 = First[GroebnerBasis[{r^4 - 2*c*r^3 + (c^2 - 2*a^2)*r^2 +
> 2*a^2*c*r - a^2*c^2, v - (2 - r)}, {a, b, c, v},
>      {r}]]
>
> Out=
> v^4 + 2*c*v^3 - 8*v^3 - 2*a^2*v^2 + c^2*v^2 - 12*c*v^2 + 24*v^2 +
> 8*a^2*v - 4*c^2*v - 2*a^2*c*v + 24*c*v - 32*v -
>    8*a^2 - a^2*c^2 + 4*c^2 + 4*a^2*c - 16*c + 16
>
>  From this we can easily see what the inverse of v is as a
> polynomial in
> v with rational coefficients, and by substituting 2-r for v we can
> also
> get a polynomial in r. We proceed as follows. First we find the free
> term (not involving v) in poly1:
>
> In:=
> free = poly1 /. v -> 0
>
> Out=
> (-c^2)*a^2 + 4*c*a^2 - 8*a^2 + 4*c^2 - 16*c + 16
>
> Next we subtract the free term from poly1 and divide by v:
>
> In:=
> poly2 = Cancel[(poly1 - free)/v]
>
> Out=
> v^3 + 2*c*v^2 - 8*v^2 - 2*a^2*v + c^2*v - 12*c*v + 24*v + 8*a^2 -
> 4*c^2 - 2*a^2*c + 24*c - 32
>
> Now substitute 2-r for v:
>
> In:=
> q = Expand[poly2 /. v -> 2 - r]
>
> Out=
> -r^3 + 2*c*r^2 - 2*r^2 + 2*a^2*r - c^2*r + 4*c*r - 4*r + 4*a^2 -
> 2*c^2 - 2*a^2*c + 8*c - 8
>
> The inverse ought to be the polynomial poly3 given by:
>
> In:=
> poly3 = Expand[(q/free)*(r - 2)]
>
> Out=
> -(r^4/((-c^2)*a^2 + 4*c*a^2 - 8*a^2 + 4*c^2 - 16*c + 16)) +
>    (2*c*r^3)/((-c^2)*a^2 + 4*c*a^2 - 8*a^2 + 4*c^2 - 16*c + 16) +
>    (2*a^2*r^2)/((-c^2)*a^2 + 4*c*a^2 - 8*a^2 + 4*c^2 - 16*c + 16) -
>    (c^2*r^2)/((-c^2)*a^2 + 4*c*a^2 - 8*a^2 + 4*c^2 - 16*c + 16) -
>    (2*a^2*c*r)/((-c^2)*a^2 + 4*c*a^2 - 8*a^2 + 4*c^2 - 16*c + 16) -
>    (8*a^2)/((-c^2)*a^2 + 4*c*a^2 - 8*a^2 + 4*c^2 - 16*c + 16) +
>    (4*c^2)/((-c^2)*a^2 + 4*c*a^2 - 8*a^2 + 4*c^2 - 16*c + 16) +
>    (4*a^2*c)/((-c^2)*a^2 + 4*c*a^2 - 8*a^2 + 4*c^2 - 16*c + 16) -
>    (16*c)/((-c^2)*a^2 + 4*c*a^2 - 8*a^2 + 4*c^2 - 16*c + 16) + 16/((-
> c^2)*a^2 + 4*c*a^2 - 8*a^2 + 4*c^2 - 16*c + 16)
>
> Finally we check that this is indeed the inverse of r-2 modulo the
> original polynomial p:
>
> In:=
> FullSimplify[PolynomialReduce[poly3, r^4 - 2*c*r^3 + (c^2 - 2*a^2)
> *r^2 + 2*a^2*c*r - a^2*c^2, r]]
>
> Out=
> {{1/(a^2*((c - 4)*c + 8) - 4*(c - 2)^2)}, 1}
>
> We get the remainder 1, as we should.
>
> Andrzej Kozlowski
>
>
> -------------------------------------------------------------------
> The information contained in this message may be CONFIDENTIAL and is
> intended for the addressee only. Any unauthorised use,
> dissemination of the
> information or copying of this message is prohibited. If you are
> not the