Macaulay2 » Documentation
Packages » Macaulay2Doc :: frac
next | previous | forward | backward | up | index | toc

frac -- construct a fraction field

Synopsis

Description

i1 : F = frac ZZ

o1 = QQ

o1 : Ring
i2 : F = frac (ZZ[a,b])

o2 = F

o2 : FractionField
After invoking the frac command, the elements of the ring are treated as elements of the fraction field:
i3 : R = ZZ/101[x,y];
i4 : gens gb ideal(x^2*y - y^3)

o4 = | x2y-y3 |

             1      1
o4 : Matrix R  <-- R
i5 : K = frac R;
i6 : gens gb ideal(x^2*y - y^3)

o6 = | 1 |

             1      1
o6 : Matrix K  <-- K
Another way to obtain frac R is with x/y where x, y are elements of R:
i7 : a*b/b^4

      a
o7 = --
      3
     b

o7 : F
Fractions are reduced to the extent possible.
i8 : f = (x-y)/(x^6-y^6)

                      1
o8 = ----------------------------------
      5    4     3 2    2 3      4    5
     x  + x y + x y  + x y  + x*y  + y

o8 : K
i9 : (x^3 - y^3) * f

      x - y
o9 = -------
      3    3
     x  + y

o9 : K
The parts of a fraction may be extracted.
i10 : numerator f

o10 = 1

o10 : R
i11 : denominator f

       5    4     3 2    2 3      4    5
o11 = x  + x y + x y  + x y  + x*y  + y

o11 : R
Alternatively, the functions lift and liftable can be used.
i12 : liftable(1/f,R)

o12 = true
i13 : liftable(f,R)

o13 = false
i14 : lift(1/f,R)

       5    4     3 2    2 3      4    5
o14 = x  + x y + x y  + x y  + x*y  + y

o14 : R
One can form resolutions and Gröbner bases of ideals in polynomial rings over fraction fields, as in the following example. Note that computations over fraction fields can be quite slow.
i15 : S = K[u,v];
i16 : I = ideal(y^2*u^3 + x*v^3, u^2*v, u^4);

o16 : Ideal of S
i17 : gens gb I

o17 = | u2v u3+x/y2v3 v4 uv3 |

              1      4
o17 : Matrix S  <-- S
i18 : Ires = res I

       1      3      2
o18 = S  <-- S  <-- S  <-- 0
                            
      0      1      2      3

o18 : ChainComplex
i19 : Ires.dd_2

o19 = {3} | 0   y2/xuv    |
      {3} | -v2 (-y2)/xu2 |
      {4} | u   -v        |

              3      2
o19 : Matrix S  <-- S
One way to compute a blowup of an ideal I in R, is to compute the kernel of a map of a new polynomial ring into a fraction field of R, as shown below.
i20 : A = ZZ/101[a,b,c];
i21 : f = map(K, A, {x^3/y^4, x^2/y^2, (x^2+y^2)/y^4});

o21 : RingMap K <-- A
i22 : kernel f

              3     2     2     3 2    3       3
o22 = ideal (b c - a b - a , a*b c  - a b*c - a c)

o22 : Ideal of A

Caveat

The input ring should be an integral domain.

Currently, for S as above, one cannot define frac S or fractions u/v. One can get around that by defining B = ZZ/101[x,y,u,v] and identify frac S with frac B.

Note that expressions such as frac QQ[x] are parsed as (frac QQ)[x]. To obtain the fraction field of QQ[x] use instead frac (QQ[x]).

See also

Ways to use frac :

For the programmer

The object frac is a method function.