# 'Reference' request: Program to work with cyclic quotient singularities.

I'm looking for program code to deal with cyclic quotient singularities on normal surfaces. In particular, at the moment I need that given a singularity $p$ like $p=\frac{1}{n}(1,a)$ the code computes:

1. Its continuous fraction decomposition (i.e. $\frac{1}{n}(1,a)=[b_1,\ldots,b_k]$). Of course, the $b_i$ are the self-intersection numbers of the exceptional curves of the minimal resolution.
2. The discrepancies of the resolution, i.e. if the minimal resolution of $p$ is $f:Y\rightarrow X$ and has exceptional curves $E_i$, then we can write $$f^*(K_X)=K_Y+\sum a_i E_i.$$ I want to find the values of $a_i$ automatically.

I know there is code written for 1. for instance in Magma or in several pages on the Internet, but I haven't seen any for the second one, and having asked around no one seem to know about it.

I know both things are pretty much automatic, for the second one we just need to intersect the above formula with each E_i, use the genus formula and resolve a linear system of equations. It should not be a difficult task (albeit a boring one) to write this code myself in Maple (which is the only mathematical language I've ever used) but I'd like to save myself the hassle and time. Moreover, I will most likely need to add code for other computations on top of this code. Code that maybe (let me dream), other people may useful in the future. I'd rather prefer to add something to an existing library than have several partial-functional libraries in different languages around.

Also, if no one knows about (2) but knows code or settings in Magma, Macaulay2... that deals easily with (1), please refer me to it and I'll build (2) over that.

Thanks!

-
Magma does too much more and different than you want. The $a_i$ shall come from the global desingularization. Then the HomAdjoints will give canonical sheaf sections. If you work just at one alone singularity, you might need to rip open the Magma code to see how they do it. The main file is package/Geometry/SrfHyp/surface_resolution.m –  Junkie Feb 28 '12 at 4:31
For (2), at least when $n$ is prime, see page 93 (page 100 of the actual pdf) of Giancarlo A. Urzua's Thesis here: http://deepblue.lib.umich.edu/bitstream/2027.42/60657/1/gian_1.pdf