Changeset 917fb5 in git for Singular/LIB/solve.lib
- Timestamp:
- Jul 6, 1999, 5:33:00 PM (25 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- 8e7ed6b81b8840e62d72f281eef096b71dc1b37e
- Parents:
- ce7ba606241efb95de4d1ab5581428b7143b3be2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/solve.lib
rce7ba6 r917fb5 1 1 /////////////////////////////////////////////////////////////////////////////// 2 2 3 version="$Id: solve.lib,v 1. 8 1999-07-06 11:33:13 obachmanExp $";3 version="$Id: solve.lib,v 1.9 1999-07-06 15:32:57 Singular Exp $"; 4 4 info=" 5 5 LIBRARY: solve.lib PROCEDURES TO SOLVE POLYNOMIAL SYSTEMS … … 21 21 l>0: defines precision of fractional part if ground field is Q 22 22 m=0,1,2: number of iterations for approximation of roots (default=2) 23 ASSUME: i is a zerodimensional ideal with 24 nvars(basering) = ncols(i) = number of vars actually occuring in i 23 ASSUME: i is a zerodimensional ideal with 24 nvars(basering) = ncols(i) = number of vars actually occuring in i 25 25 RETURN: list of all (complex) roots of the polynomial system i = 0, 26 26 of type number if the ground field is the complex numbers, … … 33 33 int prec=30; 34 34 35 if ( size(#) >= 1 ) 36 37 38 if ( typ < 0 || typ > 1 )39 40 ERROR("Valid values for second parameter k are: 41 42 43 44 45 if ( size(#) >= 2 ) 46 47 48 49 if ( prec < 0 )50 51 52 53 54 if ( size(#) >= 3 ) 55 56 57 if ( polish < 0 || polish > 2 )58 59 ERROR("Valid values for fourth parameter m are: 60 61 62 63 64 if ( size(#) > 3 ) 65 66 67 35 if ( size(#) >= 1 ) 36 { 37 typ= #[1]; 38 if ( typ < 0 || typ > 1 ) 39 { 40 ERROR("Valid values for second parameter k are: 41 0: use sparse Resultant (default) 42 1: use Macaulay Resultant"); 43 } 44 } 45 if ( size(#) >= 2 ) 46 { 47 prec= #[2]; 48 if ( prec == 0 ) { prec = 30; } 49 if ( prec < 0 ) 50 { 51 ERROR("Third parameter l must be positive!"); 52 } 53 } 54 if ( size(#) >= 3 ) 55 { 56 polish= #[3]; 57 if ( polish < 0 || polish > 2 ) 58 { 59 ERROR("Valid values for fourth parameter m are: 60 0,1,2: number of iterations for approximation of roots"); 61 } 62 } 63 64 if ( size(#) > 3 ) 65 { 66 ERROR("only three parameters allowed!"); 67 } 68 68 69 69 int digits= system("setFloatDigits",prec); 70 70 71 71 return(uressolve(gls,typ,polish)); 72 72 73 73 } 74 74 example … … 81 81 // result is a list (x,y)-coordinates as strings 82 82 83 pause ;84 // now with complex coefficient field, precision is 10 digits 83 pause(); 84 // now with complex coefficient field, precision is 10 digits 85 85 ring rsc= (real,10,I),(x,y),lp; 86 86 ideal i = (2+3*I)*x2 + (0.35+I*45.0e-2)*y2 - 8, x2 + xy + (42.7)*y2; … … 104 104 int prec=30; 105 105 106 if ( size(#) >= 1 ) 107 108 109 110 if ( prec < 0 )111 112 113 114 115 if ( size(#) >= 2 ) 116 117 118 if ( polish < 0 || polish > 2 )119 120 ERROR("Valid values for third parameter are: 121 122 123 124 if ( size(#) > 2 ) 125 126 127 106 if ( size(#) >= 1 ) 107 { 108 prec= #[1]; 109 if ( prec == 0 ) { prec = 30; } 110 if ( prec < 0 ) 111 { 112 ERROR("Fisrt parameter must be positive!"); 113 } 114 } 115 if ( size(#) >= 2 ) 116 { 117 polish= #[2]; 118 if ( polish < 0 || polish > 2 ) 119 { 120 ERROR("Valid values for third parameter are: 121 0,1,2: number of iterations for approximation of roots"); 122 } 123 } 124 if ( size(#) > 2 ) 125 { 126 ERROR("only two parameters allowed!"); 127 } 128 128 129 129 int digits= system("setFloatDigits",prec); 130 130 131 131 return(laguerre(f,polish)); 132 132 133 133 } 134 134 example … … 140 140 laguerre_solve(f); 141 141 142 pause ;142 pause(); 143 143 // Now with 10 digits precision: 144 144 laguerre_solve(f,10); 145 145 146 pause ;146 pause(); 147 147 // Now with complex coefficients, precision is 20 digits: 148 148 ring rsc= (real,20,I),x,lp; … … 158 158 k=1: resultant matrix of Macaulay (k=0 is default) 159 159 ASSUME: nvars(basering) = ncols(i)-1 = number of vars actually occuring in i, 160 for k=1 i must be homogeneous 161 RETURN: module representing the multipolynomial resultant matrix 160 for k=1 i must be homogeneous 161 RETURN: module representing the multipolynomial resultant matrix 162 162 EXAMPLE: example mp_res_mat; shows an example 163 163 " … … 165 165 int typ=2; 166 166 167 if ( size(#) == 1 ) 168 169 170 if ( typ < 0 || typ > 1 )171 172 173 174 175 176 177 if ( size(#) > 1 ) 178 179 180 167 if ( size(#) == 1 ) 168 { 169 typ= #[1]; 170 if ( typ < 0 || typ > 1 ) 171 { 172 ERROR("Valid values for third parameter are: 173 0: sparse resultant (default) 174 1: Macaulay resultant"); 175 } 176 } 177 if ( size(#) > 1 ) 178 { 179 ERROR("only two parameters allowed!"); 180 } 181 181 182 182 return(mpresmat(i,typ)); 183 183 184 184 } 185 185 example … … 194 194 det(m); 195 195 196 pause ;196 pause(); 197 197 // compute resultant matrix (Macaulay resultant matrix) 198 198 ring rdq= (0,u0,u1,u2),(x0,x1,x2),lp; … … 204 204 det(m); 205 205 206 pause ;206 pause(); 207 207 // compute numerical sparse resultant matrix 208 208 setring rsq; … … 219 219 ASSUME: ground field K is the rational numbers, 220 220 p and v consist of numbers of the ground filed K, p must have 221 n elements, v must have N=(d+1)^n elements where n=nvars(basering) 222 and d=deg(f) (f is the unknown polynomial in K[x1,...,xn]) 221 n elements, v must have N=(d+1)^n elements where n=nvars(basering) 222 and d=deg(f) (f is the unknown polynomial in K[x1,...,xn]) 223 223 COMPUTE: polynomial f with values given by v at points p1,..,pN derived from p; 224 224 more precisely: consider p as point in K^n and v as N elements in K, … … 251 251 } 252 252 /////////////////////////////////////////////////////////////////////////////// 253 254 255 256 257 258
Note: See TracChangeset
for help on using the changeset viewer.