# Singular          #### D.4.16.1 regIdeal

Procedure from library `mregular.lib` (see mregular_lib).

Usage:
regIdeal (i[,e]); i ideal, e integer

Return:
an integer, the Castelnuovo-Mumford regularity of i.
(returns -1 if i is not homogeneous)

Assume:
i is a homogeneous ideal of the basering S=K[x(0)..x(n)]. e=0: (default)
If K is an infinite field, makes random changes of coordinates. If K is a finite field, works over a transcendental extension. e=1: Makes random changes of coordinates even when K is finite. It works if it terminates, but may result in an infinite loop. After 30 loops, a warning message is displayed and -1 is returned.

Note:
If printlevel > 0 (default = 0), additional info is displayed: dim(S/i), depth(S/i) and end(H^(depth(S/i))(S/i)) are computed, and an upper bound for the a-invariant of S/i is given. The algorithm also determines whether the regularity is attained or not at the last step of a minimal graded free resolution of i, and if the answer is positive, the regularity of the Hilbert function of S/i is given.

Example:
 ```LIB "mregular.lib"; ring r=0,(x,y,z,t,w),dp; ideal i=y2t,x2y-x2z+yt2,x2y2,xyztw,x3z2,y5+xz3w-x2zw2,x7-yt2w4; regIdeal(i); ==> 10 regIdeal(lead(std(i))); ==> 13 // Additional information is displayed if you change printlevel (=1); ```

### Misc 