incr-set prlevel 1
if #0>=3 START
incr-set prlevel -1
;;; Usage:
;;; 	<rational_surface1 d pointsmat ls [mults]
;;;
;;; computes a linear series ls of the form |dL - \sum ni pi|, where L is
;;; a line in Pr, pi are points in Pr specified in pointsmat, ni are
;;; optional multiplicities specified as the degree of the generators
;;; in the ideal mults.
;;; Example of a pointsmat for the 4 coordinate points in P2:
;;;     1 0 0 1
;;;     0 1 0 1
;;;     0 0 1 1
;;; Example of a suitable matrix for mults:
;;;     a5 a7 a a3
;;;
;;; The output ls is an ideal over the current ring, which must have
;;; at least r+1 variables.  It is generated by the forms of degree
;;; d vanishing at point pi from pointsmat with multiplicity mi from
;;; mult.
;;; 
;;;
incr-set prlevel 1
jump END
;;; Parameters:
;;;        d positive = integer
;;;        pointsmat = integer 3xn matrix
;;;        [mults] = optional ideal
;;; Output values:
;;;        I an ideal ls generated by forms of degree d
; created 5/10/90 DE
START:

;form the ideal of the points
if #0=4 withmults
<points #2 @L
jump continue
withmults:
<points #2 @L #4
continue:

;Now find the vectorspace of forms of degree d from @L
res @L @L
k-basis @L.2 @M
	#1
	#1
mult @L.1 @M @L

copy @L #3

kill @M @L
END:
incr-set prlevel -1

$;;;;;;;; EXAMPLE SECTION ;;;;;;;;;;;;;;;;;;;;;;;;;
;The del Pezzo of degree 9-e in P(9-e)
reset
int e 4

<ring 3 a-z r
random 3 e p
<rational_surface1 3 p ls
<res ls ls
betti ls
listvars

; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;An easy example with multiplicities:
<ring 3 a-z r
random 3 3 p
<ideal mul a2 a a
<rational_surface1 3 p ls mul
<res ls ls
betti ls
listvars

; ;;;;;;;;;;;;;;;;;
;The surface of ype 3,5 on the Grassmannian:
reset
<ring 3 a-z r
<column_vector p 1 1 1
<column_vector q1 1 0 0
<column_vector q2 0 1 0
<column_vector q3 0 0 1
concat p q1
concat p q2
concat p q3
random 3 6 p2
concat p p2
type p
<ideal mul a2 a2 a2 a2 a2 a2 a a a a
;set prlevel -3
<rational_surface1 6 p ls mul
<res ls ls
betti ls
