## Title: Matrix Representation ## Created: March 2010 ## Authors: Luu Ba Thang ## Advisor: Laurent Buse ## ## ---------------------------------------------------------------------- ## Description: This part consists in somes algorithms to compute the representation matrices of parameterized ## plane curve,parameterized surface, parameterized space curves. ##------------------------------------------------------------------------- ## Version last modified 04/2010 ##------------------------------------------------------------------------- __ := NULL: addtohelp := proc() global __; __ := __, args: end: with(LinearAlgebra): with(MatrixPolynomialAlgebra): with(PolynomialTools): with(Groebner): #---------------------------------------------------------------------- addtohelp(Matrixf): #---------------------------------------------------------------------- ## HELP Matrixf ## CALLING SEQUENCE: ## Matrixf(f,var,v,d) ## DESCRIPTION: ## - f - homogeneous polynomials of var; ## - var - set of variables ## - d - degree of f ## - v - interger ## Return: A matrix of multiplied map by f from graded ring K[var]_{v-1} to graded ring K[var]_{v+d-1} in the monomial basis ## EXAMPLES: ## Matrixf(s*s,[s,t],1,2) ## Matrix(4, 2, {(1, 1) = 0, (1, 2) = 0, (2, 1) = 0, (2, 2) = 0, (3, 1) = 1, (3, 2) = 0, (4, 1) = 0, (4, 2) = 1}) Matrixf := proc (f, var, v, d) local c1, c3, M, N, P, m, n, i, j, Z, p, A, q, c, T; c1 := [coeffs(expand(convert(var, `+`)^v), var, 's1')]; M := [s1]; p := Dimension(Vector(c1)); c3 := [coeffs(expand(convert(var, `+`)^(v+d)), var, 't1')]; P := [t1]; n := Dimension(Vector(c3)); T := Matrix(n, 1); for i to p do c := [coeffs(expand(convert([f, M[i]], `*`)), var, 'u1')]; N := [u1]; m := Dimension(Vector(c)); if 1 < m then Z := Matrix(n, 1); for j to m do if member(N[j], P, 'k') then q := k; Z[q, 1] := c[j] end if end do else if m = 1 then Z := Matrix(n, 1); if member(N[1], P, 'k') then q := k; Z[q, 1] := c[1] end if end if end if; T := `<|>`(T, Z) end do; A := DeleteColumn(T, 1); RETURN(A); end proc: #---------------------------------------------------------------------- addtohelp(MatrixKoszulDeg): #---------------------------------------------------------------------- ## HELP MatrixKoszulDeg ## CALLING SEQUENCE: ## MatrixKoszulDeg(f,var,v) ## DESCRIPTION: ## - f - List of homogeneous polynomials with d[i]:=degree(f[i],var); ## - var - set of variables of f ## RETURN: A matrix of multiplied map by f from graded ring K[var]_{v-d[0]}+...+K[var]_{v-d[n]} ## to graded ring K[var]_{v} in the monomial basis; ## REMARK: v>=max(d[i], 0=`(F,A[j]); end do: RETURN(F); end proc: ######### Matrices Representation of parameterized plane curves############# MatrixKern := proc (A) local B, C, m, n, p, i; B := NullSpace(A); m := RowDimension(A); n := ColumnDimension(A); p := n-Rank(A); if 1 < p then C := Matrix(B[1]); for i from 2 to p do C := `<|>`(C, Matrix(B[i])) end do else if p = 1 then C := Matrix(C[1]) else MatrixEmpty end if end if end proc: #---------------------------------------------------------------------- addtohelp(MatrixPlaneCurve): #---------------------------------------------------------------------- ## HELP MatrixPlaneCurve ## CALLING SEQUENCE: ## MatrixPlaneCurve(f,var,varimpl,v) ## DESCRIPTION: ## - f - List of three homogeneous polynomials with the same degree d:=degree(fi,var) and GCD(f0,f1,f2)=1. ## - var - List of variables of f. ## - varimpl - List of variable implicits. ## - v - an interger. ## RETURN: A matrix representation of parameterized plane curve. ## CONDITIONS: v>= 2d-1. ## EXAMPLES: ## MatrixPlaneCurve([s*s,s*t,t*t], [s, t],[x,y,z],3) ## Matrix(2, 2, {(1, 1) = z, (1, 2) = y, (2, 1) = -y, (2, 2) = -x}) ## MatrixPlaneCurve([s*s*s, s*s*t, s*t*t], [s, t],[x,y,z],5) ## Matrix(3, 4, {(1, 1) = -x, (1, 2) = -x, (1, 3) = 0, (1, 4) = -y, ## (2, 1) = 0, (2, 2) = y, (2, 3) = -x, (2, 4) = z, ## (3, 1) = z, (3, 2) = 0, (3, 3) = y, (3, 4) = 0}) MatrixPlaneCurve := proc (f, var,varimpl, v) local A, B, C, m, n, Z, i, j,d; d:=degree(f[1],var); A := MatrixKoszulDeg(f, var,v); B := MatrixKern(A); C := Transpose(B); n := RowDimension(C); Z := Matrix(d, n); for i to d do for j to n do Z[i, j] := varimpl[1]*C[j, i]+varimpl[2]*C[j, i+d]+varimpl[3]*C[j, i+2*d]; end do end do; RETURN(Z); end proc: ######### Matrices Representation of parameterized surfaces ############# #---------------------------------------------------------------------- addtohelp(MatrixRepSurface): #---------------------------------------------------------------------- ## HELP MatrixRepSurface ## CALLING SEQUENCE: ## MatrixRepSurface(f,var,varimpl,v) ## DESCRIPTION: ## - Given a parameterized surfaces with parameterized [f0,f1,f2,f3]. ## - f0,f1,f2,f3 - homogeneous polynomials with the same degree d:=degree(fi,var) and GCD(f0,f1,f2,f3)=1. ## - varimpl - List of implicit variable. ## - var - List of variables of f. ## - v - an interger. ## RETURN: A matrix representation of parameterized surfaces ## CONDITIONS: v>= 3d-2 (In the some case, v may be smaller). ## EXAMPLES: ## MatrixRepSurface([s^2+t^2+u^2, 2*s*u, 2*s*t, s^2-t^2-u^2], [s, t, u], [x, y, z, w], 3). ## Matrix(3, 4, {(1, 1) = -y, (1, 2) = -z, (1, 3) = -x+w, (1, 4) = 0, ## (2, 1) = 0, (2, 2) = x+w, (2, 3) = z, (2, 4) = -y, ## (3, 1) = x+w, (3, 2) = 0, (3, 3) = y, (3, 4) = z}) MatrixRepSurface := proc (f, var, varimpl, v) local A, B, C, m, n, Z, i, j,d,k; d:=0; k:=nops(f); for i from 1 to k do d:= max(d,degree(f[i],var)); end do; d:=degree(f[1],var); A := MatrixKoszulDeg(f, var, v); B := MatrixKern(A); C := Transpose(B); m := (1/2)*(v-d+1)*(v-d+2); n := RowDimension(C); Z := Matrix(m, n); for i to m do for j to n do Z[i, j] := varimpl[1]*C[j, i]+varimpl[2]*C[j, i+m]+varimpl[3]*C[j, i+2*m]+varimpl[4]*C[j, i+3*m] end do end do; RETURN(Z); end proc: ######### Matrices Representation of parameterized space curves ############# #-------------------------------------------------------------------------- addtohelp(MatrixSpaceCurveBase): #-------------------------------------------------------------------------- ## HELP MatrixSpaceCurveBase ## CALLING SEQUENCE: ## MatrixSpaceCurveBase(f, var,varimpl) ## DESCRIPTION: ## - Given a parameterized space curve with parameterized f:=[f0,f1,f2,f3]. ## - f0,f1,f2,f3 - homogeneous polynomials of the same degree d and GCD(f0,f1,f2,f3)=1. ## - varimplv - List of variable implicit. ## - var - List of variables of f. ## RETURN: Matrix Representation of space parameterized curves. ## EXAMPLES: 1) MatrixSpaceCurve([s^4*t*t+s^5*t, t^6+s^4*t^2+s^6, t^6-s^3*t^3, s^5*t+s^6],[s,t],[x,y,z,w]) ## Matrix(5, 9, {(1, 1) = (5/12)*y-(1/2)*z-(5/12)*w, (1, 2) = 0, (1, 3) = (3/2)*z-(3/2)*y+(3/2)*w, (1, 4) = 0, (1, 5) = 0, (1, 6) = -x, (1, 7) = 0, (1, 8) = 0, (1, 9) = 0, ## (2, 1) = 0, (2, 2) = (1/12)*y-(1/12)*z+(3/4)*w-(5/12)*x, (2, 3) = 0, (2, 4) = (3/2)*x+(5/2)*w, (2, 5) = 0, (2, 6) = 0, (2, 7) = 0, (2, 8) = 0, (2, 9) = w, ## (3, 1) = -(1/12)*w-(1/2)*z+(1/2)*y, (3, 2) = (5/12)*y-(1/2)*z-(5/12)*w, (3, 3) = (3/2)*z-(3/2)*y-x, (3, 4) = 0, (3, 5) = (3/2)*z-(3/2)*y+(3/2)*w, (3, 6) = w, (3, 7) = 0, (3, 8) = -x, (3, 9) = 0, ## (4, 1) = -(1/3)*z-(7/6)*x-(2/3)*w+(1/3)*y, (4, 2) = -(1/12)*w-(1/2)*z+(1/2)*y, (4, 3) = (3/2)*x+(5/2)*w, (4, 4) = (3/2)*z-(3/2)*y+(3/2)*w, (4, 5) = (3/2)*z-(3/2)*y-x, (4, 6) = 0, (4, 7) = -x, (4, 8) = w, (4, 9) = 0, ## (5, 1) = (1/12)*y-(1/12)*z+(3/4)*w-(5/12)*x, (5, 2) = -(1/3)*z-(7/6)*x-(2/3)*w+(1/3)*y, (5, 3) = 0, (5, 4) = (3/2)*z-(3/2)*y-x, (5, 5) = (3/2)*x+(5/2)*w, (5, 6) = 0, (5, 7) = w, (5, 8) = 0, (5, 9) = -x}) ## 2) MatrixSpaceCurve([s^4, s^3*t, t^2*s^2, t^4], [s, t],[x, y, z, w]) ## Matrix(3, 5, {(1, 1) = 0, (1, 2) = y, (1, 3) = -z, (1, 4) = -x, (1, 5) = y, ## (2, 1) = -z, (2, 2) = 0, (2, 3) = y, (2, 4) = 0, (2, 5) = -x, ## (3, 1) = w, (3, 2) = -z, (3, 3) = 0, (3, 4) = y, (3, 5) = 0}) MatrixSpaceCurveBase:= proc (f, var,varimpl) local F,L,P,n; (L,P):=MubaseHomogeneous(f,var,varimpl); n := degree(L[1], var[2])+degree(L[2], var[2])-1; if degree(L[2], var[2]) >=1 then F:=MatrixKoszulDeg([L[1],L[2],L[3]],var,n); else F:= MatrixKoszulDeg([L[2],L[3]],var,n); end if; RETURN(F); end proc: #-------------------------------------------------------------------------- addtohelp(MatrixSpaceCurveDeg): #-------------------------------------------------------------------------- ## HELP MatrixSpaceCurveDeg ## CALLING SEQUENCE: ## MatrixSpaceCurveDeg(f, var,varimpl, v ) ## DESCRIPTION: ## - Given a parameterized space curve with parameterized f:=[f0,f1,f2,f3]. ## - f0,f1,f2,f3 - homogeneous polynomials with the same degree d and GCD(f0,f1,f2,f3)=1. ## - var - List of variables of f. ## - varimpl - List of variables of f. ## - v - an interger. ## RETURN: Matrix Representation of space parameterized curves. ## CONDITIONS: v>=max{\deg p+ \deg q-1,\deg p+ \deg r-1, \deg q+ \deg r-1} where p,q,r are mubase of f. ## EXAMPLES: MatrixSpaceCurveDeg([s^4*t*t+s^5*t, t^6+s^4*t^2+s^6, t^6-s^3*t^3, s^5*t+s^6], [s, t],[x,y,z,w],4) ## Matrix(5, 9, {(1, 1) = -(1/2)*z, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = (1/3)*y+(1/3)*x-(1/3)*z-(1/3)*w, (1, 6) = -(2/3)*x, (1, 7) = 0, (1, 8) = 0, (1, 9) = 0, ## (2, 1) = 0, (2, 2) = -2*x-(1/2)*z+(1/2)*y+w, (2, 3) = 0, (2, 4) = -(1/3)*x+(2/3)*w, (2, 5) = 0, (2, 6) = 0, (2, 7) = (2/3)*w, (2, 8) = 0, (2, 9) = 0, ## (3, 1) = -x, (3, 2) = -(1/2)*z, (3, 3) = (1/3)*y+(1/3)*x-(1/3)*z-(1/3)*w, (3, 4) = 0, (3, 5) = (1/3)*y-x-(1/3)*w-(1/3)*z, (3, 6) = (2/3)*w, (3, 7) = 0, (3, 8) = -(2/3)*x, (3, 9) = 0, ## (4, 1) = -(1/2)*x-(3/2)*z+(3/2)*y-(1/2)*w, (4, 2) = -x, (4, 3) = (1/3)*y-x-(1/3)*w-(1/3)*z, (4, 4) = (1/3)*y+(1/3)*x-(1/3)*z-(1/3)*w, (4, 5) = -(1/3)*x+(2/3)*w, (4, 6) = 0, (4, 7) = 0, (4, 8) = (2/3)*w, (4, 9) = -(2/3)*x, ## (5, 1) = -2*x-(1/2)*z+(1/2)*y+w, (5, 2) = -(1/2)*x-(3/2)*z+(3/2)*y-(1/2)*w, (5, 3) = -(1/3)*x+(2/3)*w, (5, 4) = (1/3)*y-x-(1/3)*w-(1/3)*z, (5, 5) = 0, (5, 6) = 0, (5, 7) = -(2/3)*x, (5, 8) = 0, (5, 9) = (2/3)*w}) MatrixSpaceCurveDeg:= proc (f, var,varimpl,v) local L,P,F; (L,P):=MubaseHomogeneous(f,var,varimpl); F:= MatrixKoszulDeg([L[1],L[2],L[3]],var,v); RETURN(F); end proc: #-------------------------------------------------------------------------- addtohelp(MatrixCurveDimension): #-------------------------------------------------------------------------- ## HELP MatrixCurveDimension ## CALLING SEQUENCE: ## MatrixSpaceCurveList(f, var,varimpl,v) ## DESCRIPTION: ## - Given a parameterized space curve with parameterized f:=[f0,f1,...,fn]. ## - f0,f1,...,fn - homogeneous polynomials with the same degree d and GCD(f0,f1,...,fn)=1. ## - var - List of variables of f. ## - varimpl - List of implicit variables ## - v - an interger, ## CONDITIONS: v>=max{\deg U[i]+ \deg U[j]-1, 1== 2*deg(lp)-1. ## RETURN: the representation matrix built from the parameterization given ## by lp which is of degree deglp. Here, the Koszul syzygies are used. The ## matrix is the one in degree degree deg. ## EXAMPLES: CurveMatrixKoszulRep([1, t, t*t], t, 3, [x, y, z]) ## Matrix(4, 6, {(1, 1) = 0, (1, 2) = 0, (1, 3) = -x, (1, 4) = 0, (1, 5) = -y, (1, 6) = 0, ## (2, 1) = -x, (2, 2) = 0, (2, 3) = 0, (2, 4) = -x, (2, 5) = z, (2, 6) = -y, ## (3, 1) = y, (3, 2) = -x, (3, 3) = z, (3, 4) = 0, (3, 5) = 0, (3, 6) = z, ## (4, 1) = 0, (4, 2) = y, (4, 3) = 0, (4, 4) = z, (4, 5) = 0, (4, 6) = 0}) CurveMatrixKoszulRep := proc(lp,var,deg,varimp) local nlp,deglp,KM,combinaison,detlp,M,k,degdiff,Mtemp,i,j; nlp:=nops(lp); deglp:=Degree(Matrix(lp),var); KM := Transpose(`<|>`(`<,>`(op(lp)), `<,>`(op(varimp)))); combinaison:=combinat[choose]([seq(i,i=1..nlp)],2); detlp:=NULL; for i from 1 to nops(combinaison) do detlp:=detlp,Determinant(SubMatrix(KM,[1,2],combinaison[i])); od; detlp:=[detlp]; M:=NULL; for k from 1 to nops(detlp) do degdiff:=deg-deglp; Mtemp:=Matrix(deg+1,degdiff+1,0); for j from 1 to degdiff+1 do for i from 1 to deg+1 do Mtemp[i,j]:=coeftayl(var^(degdiff+1-j)*detlp[k],var=0,deg+1-i); od; od; M:=; od; return(M); end: [__];