# Singular

##### 7.7.5.0. annRat
Procedure from library `dmodapp.lib` (see dmodapp_lib).

Usage:
annRat(g,f); f, g polynomials

Return:
ring (a Weyl algebra) containing an ideal 'LD'

Purpose:
compute the annihilator of the rational function g/f in the
corresponding Weyl algebra

Assume:
basering is commutative and over a field of characteristic 0

Note:
Activate the output ring with the `setring` command.
In the output ring, the ideal 'LD' (in Groebner basis) is the
annihilator of g/f.
The algorithm uses the computation of Ann(f^{-1}) via D-modules,
see (SST).

Display:
If printlevel =1, progress debug messages will be printed,
if printlevel>=2, all the debug messages will be printed.

Example:
 ```LIB "dmodapp.lib"; ring r = 0,(x,y),dp; poly g = 2*x*y; poly f = x^2 - y^3; def B = annRat(g,f); setring B; LD; ==> LD[1]=3*y^2*Dx^2*Dy+2*x*Dx*Dy^2+9*y*Dx^2+4*Dy^2 ==> LD[2]=3*y^3*Dx^2-10*x*y*Dx*Dy-8*y^2*Dy^2+10*x*Dx ==> LD[3]=y^3*Dy^2-x^2*Dy^2-6*x*y*Dx+2*y^2*Dy+4*y ==> LD[4]=3*x*Dx+2*y*Dy+1 ==> LD[5]=y^4*Dy-x^2*y*Dy+2*y^3+x^2 // Now, compare with the output of Macaulay2: ideal tst = 3*x*Dx + 2*y*Dy + 1, y^3*Dy^2 - x^2*Dy^2 + 6*y^2*Dy + 6*y, 9*y^2*Dx^2*Dy-4*y*Dy^3+27*y*Dx^2+2*Dy^2, 9*y^3*Dx^2-4*y^2*Dy^2+10*y*Dy -10; option(redSB); option(redTail); LD = groebner(LD); tst = groebner(tst); print(matrix(NF(LD,tst))); print(matrix(NF(tst,LD))); ==> 0,0,0,0,0 ==> 0,0,0,0,0 // So, these two answers are the same ```