Changeset 0e760d0 in git
- Timestamp:
- Jul 2, 1999, 6:14:41 PM (24 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- bad4044b17c2db928e269ccf80888ade701dae6c
- Parents:
- 78315991a696a660dd3d43059499d754ccf8c669
- Location:
- Singular
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/solve.lib
r7831599 r0e760d0 1 1 /////////////////////////////////////////////////////////////////////////////// 2 2 3 version="$Id: solve.lib,v 1. 6 1999-07-02 14:33:45wenk Exp $";3 version="$Id: solve.lib,v 1.7 1999-07-02 16:14:41 wenk Exp $"; 4 4 info=" 5 5 LIBRARY: solve.lib PROCEDURES TO SOLVE POLYNOMIAL SYSTEMS … … 83 83 // now with complex coefficient field, precision is 10 digits 84 84 ring rsc= (real,10,I),(x,y),lp; 85 ideal i = x2 + y2 - 8, x2 + xy + 2y2;85 ideal i = (2+3*I)*x2 + (0.35+I*45.0e-2)*y2 - 8, x2 + xy + (42.7)*y2; 86 86 ures_solve(i); 87 87 // result is a list of (x,y)-coordinates of complex numbers … … 146 146 // Now with complex coefficients, precision is 20 digits: 147 147 ring rsc= (real,20,I),x,lp; 148 poly f = (15 +I*5)*x^5 + (0.25+I*2)*x^3 + x2 - 10*I;148 poly f = (15.4+I*5)*x^5 + (25.0e-2+I*2)*x^3 + x2 - 10*I; 149 149 list l = laguerre_solve(f); 150 150 l; -
Singular/gnumpc.cc
r7831599 r0e760d0 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: gnumpc.cc,v 1. 4 1999-07-02 14:28:51 SingularExp $ */4 /* $Id: gnumpc.cc,v 1.5 1999-07-02 16:14:38 wenk Exp $ */ 5 5 /* 6 6 * ABSTRACT: computations with GMP complex floating-point numbers … … 285 285 286 286 /*2 287 * za >= 0 ? 287 * za >= 0 ? ( real() > 0 || imag() > 0 ) 288 288 */ 289 289 BOOLEAN ngcGreaterZero (number a) 290 290 { 291 return TRUE; 291 if ( a == NULL ) return TRUE; 292 return ( ((gmp_complex*)a)->real().sign() > 0 || ((gmp_complex*)a)->imag().sign() > 0 ); 292 293 } 293 294 … … 330 331 { 331 332 if ( a == NULL ) return FALSE; 332 return (((gmp_complex*)a)->real().isOne() && ((gmp_complex*)a)->imag().isZero()); 333 //return (((gmp_complex*)a)->real().isOne() && ((gmp_complex*)a)->imag().isZero()); 334 return (((gmp_complex*)a)->real().isOne()); 333 335 } 334 336 … … 339 341 { 340 342 if ( a == NULL ) return FALSE; 341 return (((gmp_complex*)a)->real().isMOne() && ((gmp_complex*)a)->imag().isZero()); 343 // return (((gmp_complex*)a)->real().isMOne() && ((gmp_complex*)a)->imag().isZero()); 344 return (((gmp_complex*)a)->real().isMOne()); 342 345 } 343 346 -
Singular/gnumpfl.cc
r7831599 r0e760d0 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: gnumpfl.cc,v 1. 6 1999-07-02 15:01:42wenk Exp $ */4 /* $Id: gnumpfl.cc,v 1.7 1999-07-02 16:14:39 wenk Exp $ */ 5 5 /* 6 6 * ABSTRACT: computations with GMP floating-point numbers … … 373 373 char *start= s; 374 374 375 //Print("%s\n",s); 376 375 377 s= ngfEatFloatNExp( s ); 376 378 377 if (*s=='\0') 379 if (*s=='\0') // 0 378 380 { 379 381 if ( *(gmp_float**)a == NULL ) (*(gmp_float**)a)= new gmp_float(); 380 382 (*(gmp_float**)a)->setFromStr(start); 381 383 } 382 else if (s==start) 384 else if (s==start) // 1 383 385 { 384 386 if ( *(gmp_float**)a != NULL ) delete (*(gmp_float**)a); … … 387 389 else 388 390 { 391 if ( *s == '/' ) { 392 } 389 393 char c=*s; 390 394 *s='\0'; … … 393 397 *s=c; 394 398 } 399 400 401 395 402 return s; 396 403 } -
Singular/mpr_complex.cc
r7831599 r0e760d0 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: mpr_complex.cc,v 1.1 0 1999-07-02 15:01:43wenk Exp $ */4 /* $Id: mpr_complex.cc,v 1.11 1999-07-02 16:14:40 wenk Exp $ */ 5 5 6 6 /* … … 508 508 { 509 509 510 510 in_real=floatToStr( c.real(), oprec ); // get real part 511 511 in_imag=floatToStr( abs(c.imag()), oprec ); // get imaginary part 512 512 513 513 if (rField_is_long_C()) 514 514 { 515 int len=(strlen(in_real)+strlen(in_imag)+ 5+strlen(currRing->parameter[0]))*sizeof(char);515 int len=(strlen(in_real)+strlen(in_imag)+7+strlen(currRing->parameter[0]))*sizeof(char); 516 516 out=(char*)AllocL(len); 517 517 memset(out,0,len); 518 if ( !c.real().isZero() ) 519 sprintf(out,"(%s%s%s*%s)",in_real,c.imag().sign()>=0?"+":"-",currRing->parameter[0],in_imag); 520 else 521 sprintf(out,"(%s%s*%s)",c.imag().sign()>=0?"":"-",currRing->parameter[0],in_imag); 518 if ( !c.real().isZero() ) // (-23-i*5.43) or (15.1+i*5.3) 519 sprintf(out,"%s(%s%s%s*%s)",(c.imag().sign()<0&&c.real().sign()<0)?"+":"", 520 in_real,c.imag().sign()>=0?"+":"-",currRing->parameter[0],in_imag); 521 else // +(-i*43) or +(i*34) 522 sprintf(out,"%s(%s%s*%s)",c.imag().sign()>=0?"":"+", 523 c.imag().sign()>=0?"":"-",currRing->parameter[0],in_imag); 522 524 } 523 525 else 524 526 { 525 int len=(strlen(in_real)+strlen(in_imag)+ 8) * sizeof(char);527 int len=(strlen(in_real)+strlen(in_imag)+9) * sizeof(char); 526 528 out=(char*)AllocL( len ); 527 529 memset(out,0,len); 528 530 if ( !c.real().isZero() ) 529 sprintf(out,"(%s%s%s)",in_real,c.imag().sign()>=0?"+I*":"-I*",in_imag); 531 sprintf(out,"%s(%s%s%s)",(c.imag().sign()<0&&c.real().sign()<0)?"+":"", 532 in_real,c.imag().sign()>=0?"+I*":"-I*",in_imag); 530 533 else 531 sprintf(out,"(%s%s)",c.imag().sign()>=0?"I*":"-I*",in_imag); 534 sprintf(out,"%s(%s%s)",c.imag().sign()>=0?"":"+", 535 c.imag().sign()>=0?"I*":"-I*",in_imag); 532 536 } 533 537 FreeL( (ADDRESS) in_real ); -
Singular/mpr_global.h
r7831599 r0e760d0 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: mpr_global.h,v 1. 4 1999-06-28 16:06:27 SingularExp $ */6 /* $Id: mpr_global.h,v 1.5 1999-07-02 16:14:41 wenk Exp $ */ 7 7 8 8 /* … … 12 12 13 13 // to get detailed timigs, define MPR_TIMING 14 #define MPR_TIMING14 //#define MPR_TIMING 15 15 16 16 // Set to double or long double. double is recomended.
Note: See TracChangeset
for help on using the changeset viewer.