# Differentials of function fields#

Sage provides arithmetic with differentials of function fields.

EXAMPLES:

The module of differentials on a function field forms an one-dimensional vector space over the function field:

sage: # needs sage.rings.finite_rings sage.rings.function_field
sage: K.<x> = FunctionField(GF(4)); _.<Y> = K[]
sage: L.<y> = K.extension(Y^3 + x + x^3*Y)
sage: f = x + y
sage: g = 1 / y
sage: df = f.differential()
sage: dg = g.differential()
sage: dfdg = f.derivative() / g.derivative()
sage: df == dfdg * dg
True
sage: df
(x*y^2 + 1/x*y + 1) d(x)
sage: df.parent()
Space of differentials of Function field in y defined by y^3 + x^3*y + x

>>> from sage.all import *
>>> # needs sage.rings.finite_rings sage.rings.function_field
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(3) + x + x**Integer(3)*Y, names=('y',)); (y,) = L._first_ngens(1)
>>> f = x + y
>>> g = Integer(1) / y
>>> df = f.differential()
>>> dg = g.differential()
>>> dfdg = f.derivative() / g.derivative()
>>> df == dfdg * dg
True
>>> df
(x*y^2 + 1/x*y + 1) d(x)
>>> df.parent()
Space of differentials of Function field in y defined by y^3 + x^3*y + x


We can compute a canonical divisor:

sage: # needs sage.rings.finite_rings sage.rings.function_field
sage: k = df.divisor()
sage: k.degree()
4
sage: k.degree() == 2 * L.genus() - 2
True

>>> from sage.all import *
>>> # needs sage.rings.finite_rings sage.rings.function_field
>>> k = df.divisor()
>>> k.degree()
4
>>> k.degree() == Integer(2) * L.genus() - Integer(2)
True


Exact differentials vanish and logarithmic differentials are stable under the Cartier operation:

sage: # needs sage.rings.finite_rings sage.rings.function_field
sage: df.cartier()
0
sage: w = 1/f * df
sage: w.cartier() == w
True

>>> from sage.all import *
>>> # needs sage.rings.finite_rings sage.rings.function_field
>>> df.cartier()
0
>>> w = Integer(1)/f * df
>>> w.cartier() == w
True


AUTHORS:

• Kwankyu Lee (2017-04-30): initial version

class sage.rings.function_field.differential.DifferentialsSpace(field, category=None)[source]#

Space of differentials of a function field.

INPUT:

• field – function field

EXAMPLES:

sage: K.<x> = FunctionField(GF(4)); _.<Y> = K[]                                 # needs sage.rings.finite_rings
sage: L.<y> = K.extension(Y^3 + x^3*Y + x)                                      # needs sage.rings.finite_rings sage.rings.function_field
sage: L.space_of_differentials()                                                # needs sage.rings.finite_rings sage.rings.function_field
Space of differentials of Function field in y defined by y^3 + x^3*y + x

>>> from sage.all import *
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)# needs sage.rings.finite_rings
>>> L = K.extension(Y**Integer(3) + x**Integer(3)*Y + x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.finite_rings sage.rings.function_field
>>> L.space_of_differentials()                                                # needs sage.rings.finite_rings sage.rings.function_field
Space of differentials of Function field in y defined by y^3 + x^3*y + x


The space of differentials is a one-dimensional module over the function field. So a base differential is chosen to represent differentials. Usually the generator of the base rational function field is a separating element and used to generate the base differential. Otherwise a separating element is automatically found and used to generate the base differential relative to which other differentials are denoted:

sage: # needs sage.rings.function_field
sage: K.<x> = FunctionField(GF(5))
sage: R.<y> = K[]
sage: L.<y> = K.extension(y^5 - 1/x)
sage: L(x).differential()
0
sage: y.differential()
d(y)
sage: (y^2).differential()
(2*y) d(y)

>>> from sage.all import *
>>> # needs sage.rings.function_field
>>> K = FunctionField(GF(Integer(5)), names=('x',)); (x,) = K._first_ngens(1)
>>> R = K['y']; (y,) = R._first_ngens(1)
>>> L = K.extension(y**Integer(5) - Integer(1)/x, names=('y',)); (y,) = L._first_ngens(1)
>>> L(x).differential()
0
>>> y.differential()
d(y)
>>> (y**Integer(2)).differential()
(2*y) d(y)

Element[source]#
basis()[source]#

Return a basis.

EXAMPLES:

sage: # needs sage.rings.finite_rings sage.rings.function_field
sage: K.<x> = FunctionField(GF(4)); _.<Y> = K[]
sage: L.<y> = K.extension(Y^3 + x^3*Y + x)
sage: S = L.space_of_differentials()
sage: S.basis()
Family (d(x),)

>>> from sage.all import *
>>> # needs sage.rings.finite_rings sage.rings.function_field
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(3) + x**Integer(3)*Y + x, names=('y',)); (y,) = L._first_ngens(1)
>>> S = L.space_of_differentials()
>>> S.basis()
Family (d(x),)

function_field()[source]#

Return the function field to which the space of differentials is attached.

EXAMPLES:

sage: # needs sage.rings.finite_rings sage.rings.function_field
sage: K.<x> = FunctionField(GF(4)); _.<Y> = K[]
sage: L.<y> = K.extension(Y^3 + x^3*Y + x)
sage: S = L.space_of_differentials()
sage: S.function_field()
Function field in y defined by y^3 + x^3*y + x

>>> from sage.all import *
>>> # needs sage.rings.finite_rings sage.rings.function_field
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(3) + x**Integer(3)*Y + x, names=('y',)); (y,) = L._first_ngens(1)
>>> S = L.space_of_differentials()
>>> S.function_field()
Function field in y defined by y^3 + x^3*y + x

class sage.rings.function_field.differential.DifferentialsSpaceInclusion[source]#

Bases: Morphism

Inclusion morphisms for extensions of function fields.

EXAMPLES:

sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^2 - x*y + 4*x^3)                                    # needs sage.rings.function_field
sage: OK = K.space_of_differentials()
sage: OL = L.space_of_differentials()                                           # needs sage.rings.function_field
sage: OL.coerce_map_from(OK)                                                    # needs sage.rings.function_field
Inclusion morphism:
From: Space of differentials of Rational function field in x over Rational Field
To:   Space of differentials of Function field in y defined by y^2 - x*y + 4*x^3

>>> from sage.all import *
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1); R = K['y']; (y,) = R._first_ngens(1)
>>> L = K.extension(y**Integer(2) - x*y + Integer(4)*x**Integer(3), names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.function_field
>>> OK = K.space_of_differentials()
>>> OL = L.space_of_differentials()                                           # needs sage.rings.function_field
>>> OL.coerce_map_from(OK)                                                    # needs sage.rings.function_field
Inclusion morphism:
From: Space of differentials of Rational function field in x over Rational Field
To:   Space of differentials of Function field in y defined by y^2 - x*y + 4*x^3

is_injective()[source]#

Return True, since the inclusion morphism is injective.

EXAMPLES:

sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^2 - x*y + 4*x^3)                                # needs sage.rings.function_field
sage: OK = K.space_of_differentials()
sage: OL = L.space_of_differentials()                                       # needs sage.rings.function_field
sage: OL.coerce_map_from(OK).is_injective()                                 # needs sage.rings.function_field
True

>>> from sage.all import *
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1); R = K['y']; (y,) = R._first_ngens(1)
>>> L = K.extension(y**Integer(2) - x*y + Integer(4)*x**Integer(3), names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.function_field
>>> OK = K.space_of_differentials()
>>> OL = L.space_of_differentials()                                       # needs sage.rings.function_field
>>> OL.coerce_map_from(OK).is_injective()                                 # needs sage.rings.function_field
True

is_surjective()[source]#

Return True if the inclusion morphism is surjective.

EXAMPLES:

sage: # needs sage.rings.function_field
sage: K.<x> = FunctionField(QQ); R.<y> = K[]
sage: L.<y> = K.extension(y^2 - x*y + 4*x^3)
sage: OK = K.space_of_differentials()
sage: OL = L.space_of_differentials()
sage: OL.coerce_map_from(OK).is_surjective()
False
sage: S.<z> = L[]
sage: M.<z> = L.extension(z - 1)
sage: OM = M.space_of_differentials()
sage: OM.coerce_map_from(OL).is_surjective()
True

>>> from sage.all import *
>>> # needs sage.rings.function_field
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1); R = K['y']; (y,) = R._first_ngens(1)
>>> L = K.extension(y**Integer(2) - x*y + Integer(4)*x**Integer(3), names=('y',)); (y,) = L._first_ngens(1)
>>> OK = K.space_of_differentials()
>>> OL = L.space_of_differentials()
>>> OL.coerce_map_from(OK).is_surjective()
False
>>> S = L['z']; (z,) = S._first_ngens(1)
>>> M = L.extension(z - Integer(1), names=('z',)); (z,) = M._first_ngens(1)
>>> OM = M.space_of_differentials()
>>> OM.coerce_map_from(OL).is_surjective()
True

class sage.rings.function_field.differential.DifferentialsSpace_global(field, category=None)[source]#

Space of differentials of a global function field.

INPUT:

• field – function field

EXAMPLES:

sage: K.<x> = FunctionField(GF(4)); _.<Y> = K[]                                 # needs sage.rings.finite_rings
sage: L.<y> = K.extension(Y^3 + x^3*Y + x)                                      # needs sage.rings.finite_rings sage.rings.function_field
sage: L.space_of_differentials()                                                # needs sage.rings.finite_rings sage.rings.function_field
Space of differentials of Function field in y defined by y^3 + x^3*y + x

>>> from sage.all import *
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)# needs sage.rings.finite_rings
>>> L = K.extension(Y**Integer(3) + x**Integer(3)*Y + x, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.finite_rings sage.rings.function_field
>>> L.space_of_differentials()                                                # needs sage.rings.finite_rings sage.rings.function_field
Space of differentials of Function field in y defined by y^3 + x^3*y + x

Element[source]#
class sage.rings.function_field.differential.FunctionFieldDifferential(parent, f, t=None)[source]#

Bases: ModuleElement

Base class for differentials on function fields.

INPUT:

• f – element of the function field

• t – element of the function field; if $$t$$ is not specified, the generator of the base differential is assumed

EXAMPLES:

sage: F.<x> = FunctionField(QQ)
sage: f = x/(x^2 + x + 1)
sage: f.differential()
((-x^2 + 1)/(x^4 + 2*x^3 + 3*x^2 + 2*x + 1)) d(x)

>>> from sage.all import *
>>> F = FunctionField(QQ, names=('x',)); (x,) = F._first_ngens(1)
>>> f = x/(x**Integer(2) + x + Integer(1))
>>> f.differential()
((-x^2 + 1)/(x^4 + 2*x^3 + 3*x^2 + 2*x + 1)) d(x)

sage: K.<x> = FunctionField(QQ); _.<Y> = K[]
sage: L.<y> = K.extension(Y^3 + x + x^3*Y)                                      # needs sage.rings.function_field
sage: L(x).differential()                                                       # needs sage.rings.function_field
d(x)
sage: y.differential()                                                          # needs sage.rings.function_field
((21/4*x/(x^7 + 27/4))*y^2 + ((3/2*x^7 + 9/4)/(x^8 + 27/4*x))*y + 7/2*x^4/(x^7 + 27/4)) d(x)

>>> from sage.all import *
>>> K = FunctionField(QQ, names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(3) + x + x**Integer(3)*Y, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.function_field
>>> L(x).differential()                                                       # needs sage.rings.function_field
d(x)
>>> y.differential()                                                          # needs sage.rings.function_field
((21/4*x/(x^7 + 27/4))*y^2 + ((3/2*x^7 + 9/4)/(x^8 + 27/4*x))*y + 7/2*x^4/(x^7 + 27/4)) d(x)

divisor()[source]#

Return the divisor of the differential.

EXAMPLES:

sage: K.<x> = FunctionField(GF(5)); _.<Y> = K[]
sage: L.<y> = K.extension(Y^3 + x + x^3*Y)                                  # needs sage.rings.function_field
sage: w = (1/y) * y.differential()                                          # needs sage.rings.function_field
sage: w.divisor()                                                           # needs sage.rings.function_field
- Place (1/x, 1/x^3*y^2 + 1/x)
- Place (1/x, 1/x^3*y^2 + 1/x^2*y + 1)
- Place (x, y)
+ Place (x + 2, y + 3)
+ Place (x^6 + 3*x^5 + 4*x^4 + 2*x^3 + x^2 + 3*x + 4, y + x^5)

>>> from sage.all import *
>>> K = FunctionField(GF(Integer(5)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(3) + x + x**Integer(3)*Y, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.function_field
>>> w = (Integer(1)/y) * y.differential()                                          # needs sage.rings.function_field
>>> w.divisor()                                                           # needs sage.rings.function_field
- Place (1/x, 1/x^3*y^2 + 1/x)
- Place (1/x, 1/x^3*y^2 + 1/x^2*y + 1)
- Place (x, y)
+ Place (x + 2, y + 3)
+ Place (x^6 + 3*x^5 + 4*x^4 + 2*x^3 + x^2 + 3*x + 4, y + x^5)

sage: F.<x> = FunctionField(QQ)
sage: w = (1/x).differential()
sage: w.divisor()                                                           # needs sage.libs.pari
-2*Place (x)

>>> from sage.all import *
>>> F = FunctionField(QQ, names=('x',)); (x,) = F._first_ngens(1)
>>> w = (Integer(1)/x).differential()
>>> w.divisor()                                                           # needs sage.libs.pari
-2*Place (x)

monomial_coefficients(copy=True)[source]#

Return a dictionary whose keys are indices of basis elements in the support of self and whose values are the corresponding coefficients.

EXAMPLES:

sage: K.<x> = FunctionField(GF(5)); _.<Y> = K[]
sage: L.<y> = K.extension(Y^3 + x + x^3*Y)                                  # needs sage.rings.function_field
sage: d = y.differential()                                                  # needs sage.rings.function_field
sage: d                                                                     # needs sage.rings.function_field
((4*x/(x^7 + 3))*y^2 + ((4*x^7 + 1)/(x^8 + 3*x))*y + x^4/(x^7 + 3)) d(x)
sage: d.monomial_coefficients()                                             # needs sage.rings.function_field
{0: (4*x/(x^7 + 3))*y^2 + ((4*x^7 + 1)/(x^8 + 3*x))*y + x^4/(x^7 + 3)}

>>> from sage.all import *
>>> K = FunctionField(GF(Integer(5)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(3) + x + x**Integer(3)*Y, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.function_field
>>> d = y.differential()                                                  # needs sage.rings.function_field
>>> d                                                                     # needs sage.rings.function_field
((4*x/(x^7 + 3))*y^2 + ((4*x^7 + 1)/(x^8 + 3*x))*y + x^4/(x^7 + 3)) d(x)
>>> d.monomial_coefficients()                                             # needs sage.rings.function_field
{0: (4*x/(x^7 + 3))*y^2 + ((4*x^7 + 1)/(x^8 + 3*x))*y + x^4/(x^7 + 3)}

residue(place)[source]#

Return the residue of the differential at the place.

INPUT:

• place – a place of the function field

OUTPUT:

• an element of the residue field of the place

EXAMPLES:

We verify the residue theorem in a rational function field:

sage: # needs sage.rings.finite_rings
sage: F.<x> = FunctionField(GF(4))
sage: f = 0
sage: while f == 0:
....:     f = F.random_element()
sage: w = 1/f * f.differential()
sage: d = f.divisor()
sage: s = d.support()
sage: sum([w.residue(p).trace() for p in s])                                # needs sage.rings.function_field
0

>>> from sage.all import *
>>> # needs sage.rings.finite_rings
>>> F = FunctionField(GF(Integer(4)), names=('x',)); (x,) = F._first_ngens(1)
>>> f = Integer(0)
>>> while f == Integer(0):
...     f = F.random_element()
>>> w = Integer(1)/f * f.differential()
>>> d = f.divisor()
>>> s = d.support()
>>> sum([w.residue(p).trace() for p in s])                                # needs sage.rings.function_field
0


and in an extension field:

sage: # needs sage.rings.function_field
sage: K.<x> = FunctionField(GF(7)); _.<Y> = K[]
sage: L.<y> = K.extension(Y^3 + x + x^3*Y)
sage: f = 0
sage: while f == 0:
....:     f = L.random_element()
sage: w = 1/f * f.differential()
sage: d = f.divisor()
sage: s = d.support()
sage: sum([w.residue(p).trace() for p in s])
0

>>> from sage.all import *
>>> # needs sage.rings.function_field
>>> K = FunctionField(GF(Integer(7)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(3) + x + x**Integer(3)*Y, names=('y',)); (y,) = L._first_ngens(1)
>>> f = Integer(0)
>>> while f == Integer(0):
...     f = L.random_element()
>>> w = Integer(1)/f * f.differential()
>>> d = f.divisor()
>>> s = d.support()
>>> sum([w.residue(p).trace() for p in s])
0


and also in a function field of characteristic zero:

sage: # needs sage.rings.function_field
sage: R.<x> = FunctionField(QQ)
sage: L.<Y> = R[]
sage: F.<y> = R.extension(Y^2 - x^4 - 4*x^3 - 2*x^2 - 1)
sage: a = 6*x^2 + 5*x + 7
sage: b = 2*x^6 + 8*x^5 + 3*x^4 - 4*x^3 - 1
sage: w = y*a/b*x.differential()
sage: d = w.divisor()
sage: sum([QQ(w.residue(p)) for p in d.support()])
0

>>> from sage.all import *
>>> # needs sage.rings.function_field
>>> R = FunctionField(QQ, names=('x',)); (x,) = R._first_ngens(1)
>>> L = R['Y']; (Y,) = L._first_ngens(1)
>>> F = R.extension(Y**Integer(2) - x**Integer(4) - Integer(4)*x**Integer(3) - Integer(2)*x**Integer(2) - Integer(1), names=('y',)); (y,) = F._first_ngens(1)
>>> a = Integer(6)*x**Integer(2) + Integer(5)*x + Integer(7)
>>> b = Integer(2)*x**Integer(6) + Integer(8)*x**Integer(5) + Integer(3)*x**Integer(4) - Integer(4)*x**Integer(3) - Integer(1)
>>> w = y*a/b*x.differential()
>>> d = w.divisor()
>>> sum([QQ(w.residue(p)) for p in d.support()])
0

valuation(place)[source]#

Return the valuation of the differential at the place.

INPUT:

• place – a place of the function field

EXAMPLES:

sage: K.<x> = FunctionField(GF(5)); _.<Y> = K[]
sage: L.<y> = K.extension(Y^3 + x + x^3*Y)                                  # needs sage.rings.function_field
sage: w = (1/y) * y.differential()                                          # needs sage.rings.function_field
sage: [w.valuation(p) for p in L.places()]                                  # needs sage.rings.function_field
[-1, -1, -1, 0, 1, 0]

>>> from sage.all import *
>>> K = FunctionField(GF(Integer(5)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(3) + x + x**Integer(3)*Y, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.function_field
>>> w = (Integer(1)/y) * y.differential()                                          # needs sage.rings.function_field
>>> [w.valuation(p) for p in L.places()]                                  # needs sage.rings.function_field
[-1, -1, -1, 0, 1, 0]

class sage.rings.function_field.differential.FunctionFieldDifferential_global(parent, f, t=None)[source]#

Differentials on global function fields.

EXAMPLES:

sage: F.<x> = FunctionField(GF(7))
sage: f = x/(x^2 + x + 1)
sage: f.differential()
((6*x^2 + 1)/(x^4 + 2*x^3 + 3*x^2 + 2*x + 1)) d(x)

>>> from sage.all import *
>>> F = FunctionField(GF(Integer(7)), names=('x',)); (x,) = F._first_ngens(1)
>>> f = x/(x**Integer(2) + x + Integer(1))
>>> f.differential()
((6*x^2 + 1)/(x^4 + 2*x^3 + 3*x^2 + 2*x + 1)) d(x)

sage: K.<x> = FunctionField(GF(4)); _.<Y> = K[]                                 # needs sage.rings.finite_rings
sage: L.<y> = K.extension(Y^3 + x + x^3*Y)                                      # needs sage.rings.finite_rings sage.rings.function_field
sage: y.differential()                                                          # needs sage.rings.finite_rings sage.rings.function_field
(x*y^2 + 1/x*y) d(x)

>>> from sage.all import *
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)# needs sage.rings.finite_rings
>>> L = K.extension(Y**Integer(3) + x + x**Integer(3)*Y, names=('y',)); (y,) = L._first_ngens(1)# needs sage.rings.finite_rings sage.rings.function_field
>>> y.differential()                                                          # needs sage.rings.finite_rings sage.rings.function_field
(x*y^2 + 1/x*y) d(x)

cartier()[source]#

Return the image of the differential by the Cartier operator.

The Cartier operator operates on differentials. Let $$x$$ be a separating element of the function field. If a differential $$\omega$$ is written in prime-power representation $$\omega=(f_0^p+f_1^px+\dots+f_{p-1}^px^{p-1})dx$$, then the Cartier operator maps $$\omega$$ to $$f_{p-1}dx$$. It is known that this definition does not depend on the choice of $$x$$.

The Cartier operator has interesting properties. Notably, the set of exact differentials is precisely the kernel of the Cartier operator and logarithmic differentials are stable under the Cartier operation.

EXAMPLES:

sage: # needs sage.rings.finite_rings sage.rings.function_field
sage: K.<x> = FunctionField(GF(4)); _.<Y> = K[]
sage: L.<y> = K.extension(Y^3 + x + x^3*Y)
sage: f = x/y
sage: w = 1/f*f.differential()
sage: w.cartier() == w
True

>>> from sage.all import *
>>> # needs sage.rings.finite_rings sage.rings.function_field
>>> K = FunctionField(GF(Integer(4)), names=('x',)); (x,) = K._first_ngens(1); _ = K['Y']; (Y,) = _._first_ngens(1)
>>> L = K.extension(Y**Integer(3) + x + x**Integer(3)*Y, names=('y',)); (y,) = L._first_ngens(1)
>>> f = x/y
>>> w = Integer(1)/f*f.differential()
>>> w.cartier() == w
True

sage: # needs sage.rings.finite_rings
sage: F.<x> = FunctionField(GF(4))
sage: f = x/(x^2 + x + 1)
sage: w = 1/f*f.differential()
sage: w.cartier() == w                                                      # needs sage.rings.function_field
True

>>> from sage.all import *
>>> # needs sage.rings.finite_rings
>>> F = FunctionField(GF(Integer(4)), names=('x',)); (x,) = F._first_ngens(1)
>>> f = x/(x**Integer(2) + x + Integer(1))
>>> w = Integer(1)/f*f.differential()
>>> w.cartier() == w                                                      # needs sage.rings.function_field
True