Affine Algebras which are Fields

If the ideal J of relations defining an affine algebra A = K[x1, ..., xn]/J, where K is a field, is maximal, then A is a field and may be used with any algorithms in Magma which work over fields. Factorization of polynomials over such affine algebras is also supported (in any characteristic, since V2.10). The examples below will demonstrate some of the applications available.

Note that an affine algebra defined over a field which itself is a field also has finite dimension when considered as a vector space over its coefficient field, so all of the operations in the previous section are also available. We may instead ask for an absolute number field, presented by a single defining polynomial, and apply some basic number-field machinery to it.

> Na<v>, ma := NumberField(A : Absolute);
> Na;
Number Field with defining polynomial x^8 + 4*x^6 + 2*x^4 -
    4*x^2 + 9 over the Rational Field
> ma(a*b) eq ma(a)*ma(b);
true
> assert $1;
> Signature(Na);
0 4

Example AlgAff_EllipticCurve (H118E4)

We create the function field F = Q(a, b, x) and then the affine algebra A = F[y]/<y2 - (x3 + ax + b)> (which is also equivalent to an algebraic function field). This then allows us to create a generic elliptic curve E over A and compute the coordinates of multiples of a generic point easily.
> Q := RationalField();
> F<x, a, b> := FunctionField(Q, 3);
> A<y> := AffineAlgebra<F, y | y^2 - (x^3 + a*x + b)>;
> IsField(A);
true
> y^2;
x^3 + x*a + b
> y^-1;
1/(x^3 + x*a + b)*y
> E := EllipticCurve([A | a, b]);
> E;
Elliptic Curve defined by y^2 = x^3 + a*x + b over Affine Algebra of rank 1 over
    Rational function field of rank 3 over Rational Field
    Variables: x, a, b
> p := E ! [x, y];
> p;
(x : y : 1)
> q := 2*p;
> q;
((1/4*x^4 - 1/2*x^2*a - 2*x*b + 1/4*a^2)/(x^3 + x*a + b) : (1/8*x^6 +
5/8*x^4*a + 5/2*x^3*b - 5/8*x^2*a^2 - 1/2*x*a*b - 1/8*a^3 - b^2)/(x^6
+ 2*x^4*a + 2*x^3*b + x^2*a^2 + 2*x*a*b + b^2)*y : 1)
> c := LeadingCoefficient(q[2]);
> Denominator(c);
x^6 + 2*x^4*a + 2*x^3*b + x^2*a^2 + 2*x*a*b + b^2
> Factorization($1);
[
    <x^3 + x*a + b, 2>
]

Example AlgAff_Factorization (H118E5)

Starting with the same affine algebra A = Q(a, b, x)F[y]/<y2 - (x3 + ax + b)> as in the last example, we factor some univariate polynomials over A. A is of course isomorphic to an absolute field, but the presentation given may be much more convenient to the user.
> Q := RationalField();
> F<x, a, b> := FunctionField(Q, 3);
> A<y> := AffineAlgebra<F, y | y^2 - (x^3 + a*x + b)>;
> P<z> := PolynomialRing(A);
> f := z^2 - (x^3 + a*x + b);
> f;
z^2 + -x^3 - x*a - b
> time Factorization(f);
[
    <z - y, 1>,
    <z + y, 1>
]
Time: 0.019

Example AlgAff_MultiExtension (H118E6)

In this final example, A is isomorphic to an algebraic number field, but its presentation may be more convenient than an absolute presentation (and may lead to sparser expressions for elements).
> Q := RationalField();
> A<a,b,c> := AffineAlgebra<Q, a,b,c | a^2 - b*c + 1, b^2 - c + 1, c^2 + 2>;
> P<x> := PolynomialRing(A);
> time Factorization(x^2 + 2);
[
    <x - c, 1>,
    <x + c, 1>
]
Time: 0.080
> time Factorization(x^2 - b*c + 1);
[
    <x - a, 1>,
    <x + a, 1>
]
Time: 0.090
> MinimalPolynomial(a);
x^8 + 4*x^6 + 2*x^4 - 4*x^2 + 9
> time Factorization(P ! $1);
[
    <x - a, 1>,
    <x + a, 1>,
    <x - 1/3*a*b*c - 2/3*a*b + 1/3*a*c - 1/3*a, 1>,
    <x + 1/3*a*b*c + 2/3*a*b - 1/3*a*c + 1/3*a, 1>,
    <x^4 + 2*x^2 - 2*c - 1, 1>
]
Time: 2.809
NumberField(A) : RngMPolRes -> FldNum, Map
    Absolute: BoolElt                   Default: false
Given an affine algebra A = K[x1, ..., xn]/J over the rational field or a number field K, where the ideal J is maximal (so that A is a field), return a number field N isomorphic to A, together with the isomorphism from A to N.

By default, N is a relative number field, presented as a tower with one extension for each variable. But if the parameter Absolute is set to true, then N is instead an absolute number field, obtained by computing a primitive element of A.

Example AlgAff_NumberField (H118E7)

If the defining ideal of an affine algebra A is maximal, then A is a field; here it is isomorphic to a number field of degree 8. By default the field is presented as a relative tower, with one extension for each of the variables. We use the returned isomorphism to move elements between the two presentations.
> Q := RationalField();
> A<a,b,c> := AffineAlgebra<Q, a,b,c |
>     a^2 - b*c + 1, b^2 - c + 1, c^2 + 2>;
> IsField(A);
true
> N<w,v,u>, m := NumberField(A);
> P<x>:=PolynomialRing(BaseRing(N));
> N;
Number Field with defining polynomial x^2 - u*v + 1 over its
    ground field
> AbsoluteDegree(N);
8
> m(a);
w
> m(a*b) eq m(a)*m(b);
true
> assert $1;
> ma := m(a);
> ma @@ m eq a;
true
> assert $1;
V2.29, 10 June 2026