# How to compute the canonical divisor of a smooth variety

I cant seem to find any sort of documentation for how to compute the canonical divisor $K_X$ of a variety. My example is quite simpe: I'm just trying to compute the (anti)canonical divisor $-K_X$ of the Segre variety $\mathbb{P}^2 \times \mathbb{P}^2 \subset \mathbb{P}^8$ intersected by a quadric $Q \subset \mathbb{P}^8$ which will be a prime Fano variety so that $-K_X$ is a hyperplane section — I'm able to construct the intersection and save it as a subscheme in SageMath, but cant get much information outside of that.

It seems like the only real way to do this in SageMath is with toric varieties which is a bit frustrating.

edit retag close merge delete