Changeset d3b3ab in git
- Timestamp:
- May 2, 2005, 2:24:16 PM (18 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- ebce66fe9c5de71af2446287b25216fc9f8634ac
- Parents:
- 58f0e9648d6829b34ac7378d6842b1a441057ae6
- Location:
- Singular/LIB
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/mrrcount.lib
r58f0e9 rd3b3ab 1 // E. Tobis 12.Nov.2004 2 // last change 16. Apr. 2005 (G.-M. Greuel) 1 // $Id: mrrcount.lib,v 1.2 2005-05-02 12:24:16 Singular Exp $ 2 // E. Tobis 12.Nov.2004, April 2004 3 // last change 1. May 2005 (G.-M. Greuel) 3 4 /////////////////////////////////////////////////////////////////////////////// 4 5 category="Symbolic-numerical solving" 5 6 info=" 6 LIBRARY: mrrcount.lib Counting number of real roots of polynomial systems7 AUTHOR: Enrique A. Tobis, etobis@dc.uba.ar 7 LIBRARY: mrrcount.lib Counting the number of real roots of polynomial systems 8 AUTHOR: Enrique A. Tobis, etobis@dc.uba.ar 8 9 9 10 OVERVIEW: Routines for counting the number of real roots of a multivariate 10 polynomial system. 11 References: 11 polynomial system. Two methods are implemented: deterministic 12 computation of the number of roots, via the signature of a certain 13 bilinear form; and a rational univariate projection, using a 14 pseudorandom polynomial. Also includes a command to verify the 15 correctness of the pseudorandom answer. 16 References: Basu, Pollack, Roy, \"Algorithms in Real Algebraic 17 Geometry\", Springer, 2003. 12 18 13 19 PROCEDURES: 14 symsignature(m) Signature of the symmetric matrix m15 sturmquery(h,B,I) Sturm query of h on V(I)16 matbil(h,B,I) Matrix of the bilinear form on R/I associated to h17 matmult(f,B,I) Matrix of multiplication by f (m_f) on R/I in the basis B18 tracemult(f,B,I) Trace of m_f (B is an ordered basis of R/I)19 coords(f,B,I) Coordinates of f in the ordered basis B20 randcharpoly(B,I ) Pseudorandom charpoly of univ. projection21 verify(p,B,i) Verifies the result of randcharpoly22 randlinpoly( ) Pseudorandom linear polynomial23 powersums(f,B,I) Powersums of the roots of a char polynomial24 symmfunc(S) Symmetric functions from the powersums S25 univarpoly(l) Polynomial with coefficients from l26 qbase(i) Like kbase, but the monomials are ordered20 symsignature(m) Signature of the symmetric matrix m 21 sturmquery(h,B,I) Sturm query of h on V(I) 22 matbil(h,B,I) Matrix of the bilinear form on R/I associated to h 23 matmult(f,B,I) Matrix of multiplication by f (m_f) on R/I in the basis B 24 tracemult(f,B,I) Trace of m_f (B is an ordered basis of R/I) 25 coords(f,B,I) Coordinates of f in the ordered basis B 26 randcharpoly(B,I,n) Pseudorandom charpoly of univ. projection, n optional 27 verify(p,B,i) Verifies the result of randcharpoly 28 randlinpoly(n) Pseudorandom linear polynomial, n optional 29 powersums(f,B,I) Powersums of the roots of a char polynomial 30 symmfunc(S) Symmetric functions from the powersums S 31 univarpoly(l) Polynomial with coefficients from l 32 qbase(i) Like kbase, but the monomials are ordered 27 33 28 34 KEYWORDS: real roots, univariate projection … … 54 60 for (j = i;j <= nrows(m);j++) { 55 61 if (m[i,j] != m[j,i]) { 56 62 ERROR ("m must be a symmetric matrix"); 57 63 } 58 64 } … … 81 87 ring r = 0,(x,y),dp; 82 88 ideal i = x4-y2x,y2-13; 83 i = groebner(i);89 i = std(i); 84 90 ideal b = qbase(i); 85 91 … … 92 98 "USAGE: sturmquery(h,b,i); h poly, b,i ideal 93 99 RETURN: number: the Sturm query of h in V(i) 94 ASSUME: b is an ordered monomial basis of r/i, r = basering 100 ASSUME: i is a Groebner basis, b is an ordered monomial basis 101 of r/i, r = basering. 95 102 SEE ALSO: symsignature,matbil 96 103 EXAMPLE: example sturmquery; shows an example" … … 107 114 ring r = 0,(x,y),dp; 108 115 ideal i = x4-y2x,y2-13; 109 i = groebner(i);116 i = std(i); 110 117 ideal b = qbase(i); 111 118 … … 113 120 } 114 121 115 static proc mysymmsig(matrix m) 122 static proc mysymmsig(matrix m) 116 123 // returns the signature of a square symmetric matrix m 117 124 { … … 166 173 ring r = 0,(x,y),dp; 167 174 ideal i = x4-y2x,y2-13; 168 i = groebner(i);175 i = std(i); 169 176 ideal b = qbase(i); 170 177 poly f = x3-xy+y-13+x4-y2x; … … 178 185 proc tracemult(poly f,ideal B,ideal I) 179 186 "USAGE: tracemult(f,b,i);f poly, b,i ideal 180 RETURN: number: the trace of the multiplication by f (m_f) on r/i, 181 written in the monomial basis b of r/i, r = basering 187 RETURN: number: the trace of the multiplication by f (m_f) on r/i, 188 written in the monomial basis b of r/i, r = basering 182 189 (faster than matmult + trace) 183 190 ASSUME: i is a Groebner basis and b is an ordered monomial basis of r/i … … 192 199 193 200 g = reduce(f,I); 194 201 195 202 m = 0; 196 203 for (k = 1;k <= size(B);k++) { … … 205 212 ring r = 0,(x,y),dp; 206 213 ideal i = x4-y2x,y2-13; 207 i = groebner(i);214 i = std(i); 208 215 ideal b = qbase(i); 209 216 … … 231 238 232 239 g = reduce(f,I); 233 240 234 241 for (k = 1;k <= size(B);k++) { 235 242 coordinates = coords(g*(B[k]),B,I); // f*x_k written on the basis B … … 245 252 ring r = 0,(x,y),dp; 246 253 ideal i = x4-y2x,y2-13; 247 i = groebner(i);254 i = std(i); 248 255 ideal b = qbase(i); 249 256 … … 290 297 ring r = 0,(x,y),dp; 291 298 ideal i = x4-y2x,y2-13; 292 i = groebner(i);293 ideal b = qbase(i); 294 299 i = std(i); 300 ideal b = qbase(i); 301 295 302 coords(x3-xy+y-13+x4-y2x,b,i); 296 303 b; … … 298 305 /////////////////////////////////////////////////////////////////////////////// 299 306 300 static proc isSquare(matrix m) 307 static proc isSquare(matrix m) 301 308 // returns 1 iff m is a square matrix 302 309 { … … 305 312 /////////////////////////////////////////////////////////////////////////////// 306 313 307 proc randcharpoly(ideal B,ideal I )308 "USAGE: randcharpoly(b,i); b,i ideal314 proc randcharpoly(ideal B,ideal I,list #) 315 "USAGE: randcharpoly(b,i); randcharpoly(b,i,n); b,i ideal; n int 309 316 RETURN: poly: the characteristic polynomial of a pseudorandom 310 rational univariate projection having one zero per zero of i 317 rational univariate projection having one zero per zero of i. 318 If n is given, it is the number of digits being used for the 319 pseudorandom coefficients (default: n=2) 311 320 ASSUME: i is a Groebner basis and b is an ordered monomial basis of r/i, 312 321 r = basering … … 320 329 poly q; 321 330 322 generic = randlinpoly(); 331 if (size(#) == 1) { 332 generic = randlinpoly(#[1]); 333 } else { 334 generic = randlinpoly(); 335 } 323 336 324 337 p = reduce(generic,I); … … 332 345 print("* verify(p,b,i) *"); 333 346 print("* *"); 334 print("* where p is the polynomial , b is the monomial basis used, and i*");335 print("* the Groebner basis of the ideal*");347 print("* where p is the polynomial I returned, b is the monomial basis *"); 348 print("* used, and i the Groebner basis of the ideal *"); 336 349 print("*********************************************************************"); 337 350 … … 343 356 ring r = 0,(x,y,z),dp; 344 357 ideal i = (x-1)*(x-2),(y-1),(z-1)*(z-2)*(z-3)^2; 345 i = groebner(i);358 i = std(i); 346 359 ideal b = qbase(i); 347 360 poly p = randcharpoly(b,i); 348 361 p; 349 362 nrroots(p); // See nrroots in urrcount.lib 350 } 363 p = randcharpoly(b,i,5); 364 p; 365 nrroots(p); 366 } 367 351 368 /////////////////////////////////////////////////////////////////////////////// 352 369 353 370 proc verify(poly p,ideal b,ideal i) 354 371 "USAGE: verify(p,b,i);p poly, b,i,ideal 355 RETURN: integer: 1 iff the polynomial p splits the points of V(i). 372 RETURN: integer: 1 iff the polynomial p splits the points of V(i). 356 373 It's used to check the result of randcharpoly 357 374 ASSUME: i is a Groebner basis and b is an ordered monomial basis of r/i, … … 376 393 } else { 377 394 print("The choice of random numbers was not useful"); 395 print("You might want to try randcharpoly with a larger number of digits"); 378 396 } 379 397 return (correct); … … 385 403 poly f = x3-xy+y-13+x4-y2x; 386 404 ideal i = x4-y2x,y2-13; 387 i = groebner(i);405 i = std(i); 388 406 ideal b = qbase(i); 389 407 poly p = randcharpoly(b,i); … … 392 410 /////////////////////////////////////////////////////////////////////////////// 393 411 394 proc randlinpoly( )395 "USAGE: randlinpoly(); 412 proc randlinpoly(list #) 413 "USAGE: randlinpoly(); randlinpoly(n); n int 396 414 RETURN: poly: a polynomial linear in each variable of the ring, with 397 pseudorandom coefficients 415 pseudorandom coefficients. If n is given, it is the number of 416 digits being used for the range of the coefficients (default: n=2) 398 417 SEE ALSO: randcharpoly; 399 418 EXAMPLE: example randlinpoly; shows an example" … … 401 420 int n,i; 402 421 poly p = 0; 403 422 int ndigits = 2; 423 424 if (size(#) == 1) { 425 ndigits = #[1]; 426 } 427 404 428 n = nvars(basering); 405 429 for (i = 1;i <= n;i++) { 406 p = p + var(i)*random(1,10 00000);430 p = p + var(i)*random(1,10^ndigits); 407 431 } 408 432 return (p); … … 413 437 ring r = 0,(x,y,z,w),dp; 414 438 poly p = randlinpoly(); 439 p; 440 p = randlinpoly(5); 415 441 p; 416 442 } … … 424 450 EXAMPLE: example symmfunc; shows an example" 425 451 { 426 int N,k; 452 int N,k; 427 453 list sums; 428 454 … … 439 465 440 466 ideal i = (x-1)*(x-2),(y-1),(z+5); // V(I) = {(1,1,-5),(2,1,-5) 441 i = groebner(i);467 i = std(i); 442 468 443 469 ideal b = qbase(i); … … 450 476 /////////////////////////////////////////////////////////////////////////////// 451 477 452 proc symmfunc(list S) 478 proc symmfunc(list S) 453 479 // Takes the list of power sums and returns the symmetric functions 454 480 "USAGE: symmfunc(s); s list … … 491 517 proc univarpoly(list l) 492 518 "USAGE: univarpoly(l); l list 493 RETURN: poly: a polynomial p on the first variable of basering, say x, 519 RETURN: poly: a polynomial p on the first variable of basering, say x, 494 520 with p = l[1] + l[2]*x + l[3]*x^2 + ... 495 521 EXAMPLE: example univarpoly; shows an example" … … 497 523 poly p; 498 524 int i,n; 499 525 500 526 n = size(l); 501 527 for (i = 1;i <= n;i++) { … … 534 560 535 561 ideal i = 2x2,-y2,z3; 536 i = groebner(i);562 i = std(i); 537 563 ideal b = qbase(i); 538 564 b; -
Singular/LIB/signcond.lib
r58f0e9 rd3b3ab 1 // $Id: signcond.lib,v 1.2 2005-05-02 12:24:16 Singular Exp $ 1 2 // E. Tobis 12.Nov.2004 2 3 // last change 16. Apr. 2005 (G.-M. Greuel) … … 5 6 info=" 6 7 LIBRARY: signcond.lib Routines for computing realizable sign conditions 7 AUTHOR: Enrique A. Tobis, etobis@dc.uba.ar 8 AUTHOR: Enrique A. Tobis, etobis@dc.uba.ar 9 10 OVERVIEW: Routines to determine the number of solutions of a multivariate 11 polynomial system which satisfy a given sign configuration. 12 References: Basu, Pollack, Roy, \"Algorithms in Real Algebraic 13 Geometry\", Springer, 2003. 8 14 9 15 PROCEDURES: 10 16 signcnd(P,I) The sign conditions realized the polynomials of P on a V(I) 11 17 psigncnd(P,l) Pretty prints the output of signcnd (l) 12 firstoct( P) The number of elements of aV(I) with every coordinate > 018 firstoct(I) The number of elements of V(I) with every coordinate > 0 13 19 14 20 KEYWORDS: real roots,sign conditions … … 22 28 "USAGE: firstoct(i); i ideal 23 29 RETURN: number: the number of points of V(i) lying in the first orthant 24 ASSUME: i is a Groebner basis 30 ASSUME: i is a Groebner basis 25 31 SEE ALSO: signcnd 26 32 EXAMPLE: example firstoct; shows an example" … … 112 118 113 119 // We initialize the cumulative variables 114 M = matrix(1,1,1); 120 M = matrix(1,1,1); 115 121 Exponents = list(list()); 116 122 Signs = list(list()); … … 131 137 132 138 133 // We determine the list of signs which correspond to a nonzero 139 // We determine the list of signs which correspond to a nonzero 134 140 // number of roots 135 141 numberOfNonZero = 3; … … 146 152 numberOfNonZero--; 147 153 } 148 154 149 155 if (c[3,1] != 0) { 150 156 signi = signi + list(-1); … … 152 158 numberOfNonZero--; 153 159 } 154 155 // We now determine the little matrix we'll work with, 160 161 // We now determine the little matrix we'll work with, 156 162 // and the list of exponents 157 163 if (numberOfNonZero == 3) { … … 162 168 Mi[1,2] = 1; 163 169 if (c[1,1] != 0 && c[2,1] != 0) { // 0,1 164 165 170 Mi[2,1] = 0; 171 Mi[2,2] = 1; 166 172 } else {if (c[1,1] != 0 && c[3,1] != 0) { // 0,-1 167 168 173 Mi[2,1] = 0; 174 Mi[2,2] = -1; 169 175 } else { // 1,-1 170 171 176 Mi[2,1] = 1; 177 Mi[2,2] = -1; 172 178 }} 173 179 exponentsi = list(0,1); … … 176 182 exponentsi = list(0); 177 183 }}} 178 184 179 185 // We store the Sturm Queries we'll need later 180 186 if (numberOfNonZero == 2) { … … 194 200 } 195 201 196 // At this point, we have the cumulative matrix, 197 // the vector of exponents and the matching sign conditions. 202 // At this point, we have the cumulative matrix, 203 // the vector of exponents and the matching sign conditions. 198 204 // We have to solve the big linear system to finish. 199 205 … … 209 215 if (j <= size(SQvalues)) { 210 216 if (SQpositions[j] == i) { 211 212 217 SQs[i,1] = SQvalues[j]; 218 j++; 213 219 } else { 214 220 SQs[i,1] = sturmquery(evalp(Exponents[i],P),B,I); 215 } 221 } 216 222 } else { 217 223 SQs[i,1] = sturmquery(evalp(Exponents[i],P),B,I); 218 224 } 219 225 } … … 244 250 echo = 0; 245 251 246 print("The output of signcnd is a list of two lists. Both lists have the 252 print("The output of signcnd is a list of two lists. Both lists have the 247 253 same"); 248 254 print("length. That length is the number of sign conditions realized by the"); 249 print ("polynomials of P on the set V(i). In this example, that number 255 print ("polynomials of P on the set V(i). In this example, that number 250 256 is"); 251 257 print("print(size(l[1]));"); … … 335 341 int i,j; 336 342 int found; 337 343 338 344 found = 0; 339 345 i = 1; … … 345 351 } else { 346 352 while(j <= size(a)) { 347 348 353 found = found && a[j] == b[i][j]; 354 j++; 349 355 } 350 356 } 351 357 i++; 352 358 } 353 359 354 360 if (found) { 355 361 return (i-1); … … 375 381 result[la*lb] = 0; 376 382 377 383 378 384 for (i = 0;i < lb;i++) { 379 385 for (j = 0;j < la;j++) { … … 398 404 /////////////////////////////////////////////////////////////////////////////// 399 405 400 static proc evalp(list exp,ideal P) // Elevates each polynomial in P to the appropriate 406 static proc evalp(list exp,ideal P) // Elevates each polynomial in P to the appropriate 401 407 { 402 408 int i; -
Singular/LIB/urrcount.lib
r58f0e9 rd3b3ab 1 // E. Tobis 12.Nov.2004 2 // last change 16. Apr. 2005 (G.-M. Greuel) 1 // $Id: urrcount.lib,v 1.2 2005-05-02 12:24:16 Singular Exp $ 2 // E. Tobis 12.Nov.2004, April 2004 3 // last change 1. May 2005 (G.-M. Greuel) 3 4 /////////////////////////////////////////////////////////////////////////////// 4 5 category="Symbolic-numerical solving" 5 6 info=" 6 7 LIBRARY: urrcount.lib Counting number of real roots of univariate polynomial 7 AUTHOR: Enrique A. Tobis, etobis@dc.uba.ar 8 AUTHOR: Enrique A. Tobis, etobis@dc.uba.ar 8 9 9 10 OVERVIEW: Routines for bounding and counting the number of real roots of a 10 univariate polynomial by using Strum and Sturm-Habicht sequences. 11 References: 11 univariate polynomial, by means of several different methods, namely 12 Descartes' rule of signs, the Budan-Fourier theorem, Sturm sequences 13 and Sturm-Habicht sequences. The first two give bounds on the number 14 of roots. The other two compute the actual number of roots of the 15 polynomial. There are several wrapper functions, to simplify the 16 application of the aforesaid theorems and some functions 17 to determine whether a given polynomial is univariate. 18 References: Basu, Pollack, Roy, \"Algorithms in Real Algebraic 19 Geometry\", Springer, 2003. 20 12 21 13 22 PROCEDURES: … … 26 35 sturmhaseq(p) A Sturm-Habicht Sequence of a polynomial 27 36 reverse(l) Reverses a list 28 nrroots(p) 37 nrroots(p) The number of real roots of p 29 38 isparam(p) Returns 0 iff the polynomial has non-parametric coefficients 30 39 … … 76 85 i = size(ar); 77 86 while (!ispar && (i >= 1)) { 78 79 87 ispar = ispar || (isparametric(ar[i])); 88 i--; 80 89 } 81 90 } else { … … 83 92 int j; 84 93 i = nrows(m); 85 while (!ispar am&& (i >= 1)) {86 87 while (!isparam&& (j >= 1)) {88 isparam = isparam|| (isparametric(m[i,j]));89 90 91 94 while (!ispar && (i >= 1)) { 95 j = nrows(m); 96 while (!ispar && (j >= 1)) { 97 ispar = ispar || (isparametric(m[i,j])); 98 j--; 99 } 100 i--; 92 101 } 93 102 } … … 97 106 while (!ispar && (i >= 1)) { 98 107 if ((typeof(#[i]) != "poly") && (typeof(#[i]) != "number") && 99 100 108 typeof(#[i]) != "int") { 109 ERROR("This procedure only works with lists of polynomials"); 101 110 } 102 111 ispar = ispar || (isparametric(#[i])); … … 161 170 SEE ALSO: isuni 162 171 EXAMPLE: example whichvariable; shows an example" 163 { 172 { 164 173 int i; 165 174 int found; … … 219 228 ERROR("This procedure cannot operate with parametric arguments"); 220 229 } 221 230 222 231 lastsign = sign(l[1]); 223 232 … … 240 249 } 241 250 /////////////////////////////////////////////////////////////////////////////// 242 proc boundBuFou(poly p,number a,number b) 251 proc boundBuFou(poly p,number a,number b) 243 252 "USAGE: boundBuFou(p,a,b); p poly, a,b number 244 RETURN: number: an upper bound for the number of real roots of p in (a,b], 245 with the same parity as the actual number of roots (using the 253 RETURN: number: an upper bound for the number of real roots of p in (a,b], 254 with the same parity as the actual number of roots (using the 246 255 Budan-Fourier Theorem) 247 256 ASSUME: p is a univarite polynomials with rational coefficients … … 273 282 274 283 d = deg(p); 275 284 276 285 // We calculate the list of derivatives 277 286 … … 425 434 proc allrealst(poly p) 426 435 "USAGE: allrealst(p); poly p 427 RETURN: int: 1 iff all the roots of p are real, 0 otherwise 436 RETURN: int: 1 iff all the roots of p are real, 0 otherwise 428 437 Checks whether all the roots of p are real by using Sturm's Theorem 429 438 ASSUME: p is a univarite polynomials with rational coefficients … … 495 504 } 496 505 /////////////////////////////////////////////////////////////////////////////// 497 proc sturm(poly p,number a,number b) 506 proc sturm(poly p,number a,number b) 498 507 "USAGE: sturm(p,a,b); poly p, number a,b 499 508 RETURN: number: the number of real roots of p in (a,b] … … 562 571 RETURN: list: a Sturm sequence of p 563 572 ASSUME: p is a univarite polynomials with rational coefficients 573 THEORY: The Sturm sequence of p (also called remainder sequence) is the 574 sequence begininng with p, p' and goes on with minus the remainder 575 of the two previous polynomials, until the remainder is zero. 576 See: Basu, Pollack, Roy, "Algorithms in Real Algebraic Geometry", 577 Springer, 2003. 564 578 SEE ALSO: sturm,sturmhaseq 565 579 EXAMPLE: example sturmseq; shows an example" … … 568 582 poly variable; 569 583 int i; 570 584 571 585 variable = isuni(p); 572 586 573 587 if (isparam(p)) { 574 588 ERROR("This procedure cannot operate with parametric arguments"); … … 578 592 ERROR ("p must be a univariate polynomial"); 579 593 } 580 594 581 595 // The two first polynomials in Sturm's sequence 582 596 stseq = list(); … … 595 609 596 610 // Right now, we have gcd(P,P') in stseq[size(stseq)]; 597 611 598 612 for (i = size(stseq)-1;i >= 1;i--) { 599 613 stseq[i] = stseq[i]/(sign(leadcoef(stseq[size(stseq)]))*stseq[size(stseq)]); 600 614 stseq[i] = stseq[i]/abs(leadcoef(stseq[i])); 601 615 } 602 616 603 617 // We divide the gcd by itself 604 618 stseq[size(stseq)] = sign(leadcoef(stseq[size(stseq)])); 605 619 606 620 return (stseq); 607 621 } … … 650 664 proc sturmha(poly P,number a,number b) 651 665 "USAGE: sturmha(p,a,b); poly p, number a,b 652 RETURN: number: the number of real roots of p in (a,b) (using a 666 RETURN: number: the number of real roots of p in (a,b) (using a 653 667 Sturm-Habicht sequence) 654 668 SEE ALSO: sturm,allreal … … 717 731 /////////////////////////////////////////////////////////////////////////////// 718 732 proc sturmhaseq(poly P) 719 "USAGE: sturmhaseq(P); P poly. P must be univariate733 "USAGE: sturmhaseq(P); P poly. 720 734 RETURN: list: the nonzero polynomials of the Sturm-Habicht sequence of P 735 ASSUME: P is a univariate polynomial. 736 THEORY: The Sturm-Habicht sequence (also subresultant sequence) is closely 737 related to the Sturm sequence, but behaves better with respect to 738 the size of the coefficients. It is defined via subresultants. 739 See: Basu, Pollack, Roy, "Algorithms in Real Algebraic Geometry", 740 Springer, 2003. 721 741 SEE ALSO: sturm,sturmseq,sturmha 722 742 EXAMPLE: example sturmhaseq; shows an example" … … 767 787 // T[k-1+2] = SR[k-1+2]; 768 788 srbar[k-1+2] = leadcoef(SR[k-1+2]); 769 } 789 } 770 790 if (k < j-1) { 771 791 // Computation of sr[k+2] 772 792 for (l = 1;l <= j-k-1;l++) { 773 793 srbar[j-l-1+2] = ((-1)^l)*(srbar[j-1+2]*srbar[j-l+2])/sr[j+2]; 774 794 } 775 795 sr[k+2] = srbar[k+2]; … … 795 815 if (typeof(SR[i]) != "none") { 796 816 if (SR[i] != 0) { 797 817 filtered = insert(filtered,SR[i]); 798 818 } 799 819 } … … 847 867 av = -x; 848 868 } 849 869 850 870 return (av); 851 871 } … … 993 1013 } else { 994 1014 temp = lastsign * sign(l[i]); 995 1015 996 1016 if (temp < 0) { 997 1017 sc++; 998 1018 } else { 999 1000 1001 1019 if (nofzeros == 2) { 1020 sc = sc + 2; 1021 } 1002 1022 } 1003 1023 nofzeros = 0; … … 1009 1029 } 1010 1030 /////////////////////////////////////////////////////////////////////////////// 1011 /////////////////////////////////////////////////////////////////////////////// 1012 1031 1032
Note: See TracChangeset
for help on using the changeset viewer.