# canonicalDivisor -- compute a canonical divisor of a ring

## Synopsis

• Usage:
canonicalDivisor( R )
• Inputs:
• Optional inputs:
• IsGraded => , default value false, specify that the returned canonical divisor should reflect the grading of the ring
• Outputs:

## Description

Compute the canonical divisor of a ring (warning, the canonical divisor is not unique, but only unique up to linear equivalence). If the IsGraded option is set to true (default false), then it will return a canonical divisor for the $Proj$ of $R$, otherwise it will return one for only the $Spec$. The graded version only works reliably for graded rings over a field (for instance, if you have a Rees algebra you will need to flatten the variables).

 i1 : R = QQ[x,y,z]; i2 : canonicalDivisor(R) o2 = 0, the zero divisor o2 : WeilDivisor on R i3 : canonicalDivisor(R, IsGraded=>true) o3 = -3*Div(x) o3 : WeilDivisor on R

Note the IsGraded option makes a difference. Consider now a non-Gorenstein singularity.

 i4 : R = QQ[a,b,c,d]/ideal(c^2-b*d, b*c-a*d, b^2-a*c); i5 : canonicalDivisor(R) o5 = -2*Div(d, c, b) o5 : WeilDivisor on R

## Caveat

Text This function assumes that the coefficientRing of the ambient ring is a field (or at least Gorenstein). If the coefficientRing is a more general ring, this function will produce a relative canonical divisor of the ring over its coefficientRing.

## Ways to use canonicalDivisor :

• "canonicalDivisor(Ring)"

## For the programmer

The object canonicalDivisor is .