Changeset 1134b5 in git
 Timestamp:
 Apr 19, 2007, 2:52:17 PM (16 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
 Children:
 bb9a5a2a1df0eacab065576595d4d0635e0ecae1
 Parents:
 fccc2cf5940d8517759ffec19729c2a215514510
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Singular/LIB/poly.lib
rfccc2c r1134b5 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: poly.lib,v 1.4 1 20070123 15:03:37 Singular Exp $";2 version="$Id: poly.lib,v 1.42 20070419 12:52:17 Singular Exp $"; 3 3 category="General purpose"; 4 4 info=" … … 104 104 @*  case 2: ring variables in v substituted by polynomials in f: 105 105 v[i] is substituted by f[i], i=1,...,i=min(size(v),ncols(f)) 106 NOTE: this procedure extends the builtin command subst which substitutes 107 ring variables only by monomials 106 NOTE: this procedure extends the builtin command subst via maps 108 107 EXAMPLE: example substitute; shows an example 109 108 " 110 111 { 112 def bas = basering; 113 ideal m = maxideal(1); 114 int i,ii; 115 if(typeof(#[1])=="poly") 116 { 117 poly v = #[1]; 118 poly f = #[2]; 119 map phi = bas,m; 120 def J = I; 121 for (ii=1; ii<=size(#)  1; ii=ii+2) 122 { 123 m = maxideal(1); 124 i=rvar(#[ii]); 125 m[i] = #[ii+1]; 126 phi = bas,m; 127 J = phi(J); 128 } 129 return(J); 130 } 131 if(typeof(#[1])=="ideal") 132 { 133 ideal v = #[1]; 134 ideal f = #[2]; 135 int mi = size(v); 136 if(ncols(f)<mi) 137 { 138 mi = ncols(f); 139 } 140 m[rvar(v[1])]=f[1]; 141 map phi = bas,m; 142 def J = phi(I); 143 for (ii=2; ii<=mi; ii++) 144 { 145 m = maxideal(1); 146 m[rvar(v[ii])]=f[ii]; 147 phi = bas,m; 148 J = phi(J); 149 } 150 return(J); 151 } 109 { 110 def bas = basering; 111 ideal m = maxideal(1); 112 int i,ii; 113 if(typeof(#[1])=="poly") 114 { 115 poly v = #[1]; 116 poly f = #[2]; 117 map phi = bas,m; 118 def J = I; 119 for (ii=1; ii<=size(#)  1; ii=ii+2) 120 { 121 m = maxideal(1); 122 i=rvar(#[ii]); 123 m[i] = #[ii+1]; 124 phi = bas,m; 125 J = phi(J); 126 } 127 return(J); 128 } 129 if(typeof(#[1])=="ideal") 130 { 131 ideal v = #[1]; 132 ideal f = #[2]; 133 int mi = size(v); 134 if(ncols(f)<mi) 135 { 136 mi = ncols(f); 137 } 138 m[rvar(v[1])]=f[1]; 139 map phi = bas,m; 140 def J = phi(I); 141 for (ii=2; ii<=mi; ii++) 142 { 143 m = maxideal(1); 144 m[rvar(v[ii])]=f[ii]; 145 phi = bas,m; 146 J = phi(J); 147 } 148 return(J); 149 } 152 150 } 153 151 example … … 172 170 int i,j; 173 171 ideal s; poly t; 174 for ( j=0; j<=n2; j =j+1)172 for ( j=0; j<=n2; j++ ) 175 173 { 176 174 t=0; 177 for( i=1;i<=n;i =i+1) { t=t+product(m,i..i+j); }175 for( i=1;i<=n;i++ ) { t=t+product(m,i..i+j); } 178 176 s=s+t; 179 177 } … … 310 308 int d=dim(std(#[1])); 311 309 int a = ( d==1 ); 312 if( size(#) >1 ) { list L=a,d; return(L); }310 if( size(#) >1 ) { return(list(a,d)); } 313 311 return(a); 314 312 } … … 336 334 i = simplify(i,6); // delete 0's and keep first of equal elements 337 335 poly m = var(1); matrix C; 338 for (ii=2;ii<=nvars(basering);ii =ii+1) { m = m*var(ii); }339 for (ii=1; ii<=size(i); ii =ii+1)336 for (ii=2;ii<=nvars(basering);ii++) { m = m*var(ii); } 337 for (ii=1; ii<=size(i); ii++) 340 338 { 341 339 C = coef(i[ii],m); 342 for (jj=1; jj<=ncols(C); jj =jj+1)340 for (jj=1; jj<=ncols(C); jj++) 343 341 { 344 342 t = string(C[2,jj]); s = size(t); … … 397 395 int r,c = nrows(M), ncols(M); int i,j; 398 396 intmat m[r][c]; 399 for (i=r; i>0; i =i1)400 { 401 for (j=c; j>0; j =j1) { m[i,j] = findmaxdeg(M[i,j]); }397 for (i=r; i>0; i) 398 { 399 for (j=c; j>0; j) { m[i,j] = findmaxdeg(M[i,j]); } 402 400 } 403 401 if (typeof(id)=="poly") { return(m[1,1]); } … … 466 464 { 467 465 int m = maxdeg(M[c]); 468 for (i=c1; i>0; i =i1)466 for (i=c1; i>0; i) 469 467 { 470 468 n = maxdeg(M[i]); … … 533 531 int r,c = nrows(M), ncols(M); int i,j; 534 532 intmat m[r][c]; 535 for (i=r; i>0; i =i1)536 { 537 for (j=c; j>0; j =j1) { m[i,j] = findmindeg(M[i,j]); }533 for (i=r; i>0; i) 534 { 535 for (j=c; j>0; j) { m[i,j] = findmindeg(M[i,j]); } 538 536 } 539 537 if (typeof(id)=="poly") { return(m[1,1]); } … … 602 600 { 603 601 int m = mindeg(M[c]); 604 for (i=c1; i>0; i =i1)602 for (i=c1; i>0; i) 605 603 { 606 604 n = mindeg(M[i]); … … 612 610 intvec v=#[1]; //weight vector for the variables 613 611 int m = findmindeg(M[c],v); 614 for (i=c1; i>0; i =i1)612 for (i=c1; i>0; i) 615 613 { 616 614 n = findmindeg(M[i],v);
Note: See TracChangeset
for help on using the changeset viewer.