incr-set prlevel 1
if #0>1 START 
incr-set prlevel -1

;;; Usage:
;;; 	<monomial_curve a1 ... an  i
;;;
;;; Sets i = the defining ideal of the projective
;;; curve given parametrically on an affine piece by 
;;; t ---> ( t^a1, ... ,t^an ).
;;; The ideal is defined in the current ring, which  
;;; MUST HAVE AT LEAST n+1 variables of equal degree at
;;; the beginning of its list of variables.
incr-set prlevel 1
jump END
;;;
;;; Parameters:
;;;	a1, ... ,an = nonnegative integers. 
;;; We must have n > 0.
;;;
;;; Output values:
;;; i = homogeneous ideal of the curve, defined over the
;;; current ring.
;;; 
;;; The script forms the subring of the polynomial ring
;;; in 2 variables t[1] and t[2] generated by
;;; 	(t[1]^m, ... , t[1]^(m-ai) t[2]^ai , ... ),
;;; where m is the maximum of the ai,
;;; and calls pushforward1 to compute the relations on it.  
;;;
;;; Note that the result will be a degenerate curve if
;;; any of the ai are repeated OR IF ONE OF THE ai=0.
;;;
;;; Caveats:
;;;		The setdegs commands produce a spurious 
;;; "; warning: module isn't homogeneous" line, which
;;; may be ignored.

; Modified 4/28/89
START:

;Get the number of parameters:
int @n #0-1
;Get a handle to the current ring:
poly @curring 0

;Form the polynomial ring in two variables
<ring 2 st @T

;To make the row of generators of the desired subring,
;we first form a row vector @g with the powers of the
;second variable -- the affine version:
poly @g 1
int @i 0
makerow:
	int @i @i+1
	poly @new t^#@i
	concat @g @new
	if @i<@n makerow

;Now homogenize it with respect to the variable s.
;To do this we must first transpose and set the row degree:
transpose @g @g
setdegs @g
	0
	;
homog @g s @g

;Now transpose back and set the rowdegrees so that
;@g becomes an ideal.
transpose @g @g
setdegs @g
	0
	;
type @g
	
;Call subring to present the subring:
setring @curring
<subring @g #(@n+1)

kill @n @curring @T'zero @T @i @new @g 
END:
incr-set prlevel -1

$;;;;;;;; EXAMPLE SECTION ;;;;;;;;;;;;;;;;;;;;;;;;;
<ring 6 a-f r

<monomial_curve
<monomial_curve 3 5 i 		; Plane quintic, g=6
nres i w
betti w
hilb w.1

set prlevel 0
<monomial_curve 3 4 5 i 		; One singular point, g=2
nres i w
betti w
hilb w.1
listvars

<monomial_curve 6 7 8 9 11  i	; Two singular points g=7
nres i w
betti w
hilb w.1

<monomial_curve 1 3 4 i		; Smooth rational quartic in P3
nres i w
betti w
hilb w.1

;The following is the same curve, but embedded in P4
;because of the extra 0 at the front!

<monomial_curve 0 1 3 4 i		; degenerate rational quartic in P4
nres i w
betti w
hilb w.1
