Changeset 63be42 in git for Singular/LIB/general.lib
- Timestamp:
- Sep 30, 1998, 7:25:36 PM (24 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 29aa4bf9f686919f5d281a96fdcd0e9e1008dbc8
- Parents:
- d3e295ae509633cf6ba993a8680945f24b9ab5ec
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/general.lib
rd3e295a r63be42 1 // $Id: general.lib,v 1. 8 1998-05-14 18:45:03Singular Exp $1 // $Id: general.lib,v 1.9 1998-09-30 17:24:31 Singular Exp $ 2 2 //system("random",787422842); 3 // (GMG, last modified 22.06.96)4 /////////////////////////////////////////////////////////////////////////////// 5 6 version="$Id: general.lib,v 1. 8 1998-05-14 18:45:03Singular Exp $";3 //GMG, last modified 30.9.98 4 /////////////////////////////////////////////////////////////////////////////// 5 6 version="$Id: general.lib,v 1.9 1998-09-30 17:24:31 Singular Exp $"; 7 7 info=" 8 8 LIBRARY: general.lib PROCEDURES OF GENERAL TYPE 9 9 10 10 A_Z(\"a\",n); string a,b,... of n comma seperated letters 11 ASCII([n,m]); string of printable ASCII characters (number n to m) 11 12 binomial(n,m[,../..]); n choose m (type int), [type string/type number] 12 13 factorial(n[,../..]); n factorial (=n!) (type int), [type string/number] … … 21 22 sort(ideal/module); sort generators according to monomial ordering 22 23 sum(vector/id/..[,v]); add components of vector/ideal/...[with indices v] 23 which(command); searches for command and returns absolute 24 path, if found 24 which(command); search for command and return absolute path, if found 25 25 (parameters in square brackets [] are optional) 26 26 "; … … 82 82 execute sR; 83 83 R; 84 } 85 /////////////////////////////////////////////////////////////////////////////// 86 proc ASCII (list #) 87 "USAGE: ASCII([n,m]); n,m= integers (32 <= n <= m <= 126) 88 RETURN: printable ASCII characters (no native language support) 89 ASCII(): string of all ASCII characters with its numbers, 90 no return value 91 ASCII(n): string, n-th ASCII charakter 92 ASCII(n,m): list, n-th up to m-th ASCII character (inclusive) 93 EXAMPLE: example ASCII; shows an example 94 " 95 { 96 string s1 = 97 " ! \" # $ % & ' ( ) * + , - . 98 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 99 100 / 0 1 2 3 4 5 6 7 8 9 : ; < = 101 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 102 103 > ? @ A B C D E F G H I J K L 104 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 105 106 M N O P Q R S T U V W X Y Z [ 107 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 108 109 \\ ] ^ _ ` a b c d e f g h i j 110 92 93 94 95 96 97 98 99 100 101 102 103 104 105 10 111 112 k l m n o p q r s t u v w x y 113 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 114 115 z { | } ~ 116 122 123 124 125 126 "; 117 118 string s2 = 119 " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; 120 121 if ( size(#) == 0 ) 122 { 123 return(s1); 124 } 125 if ( size(#) == 1 ) 126 { 127 return( s2[#[1]-31] ); 128 } 129 if ( size(#) == 2 ) 130 { 131 return( s2[#[1]-31,#[2]-#[1]+1] ); 132 } 133 } 134 example 135 { "EXAMPLE:"; echo = 2; 136 ASCII();""; 137 ASCII(42); 138 ASCII(32,126); 84 139 } 85 140 /////////////////////////////////////////////////////////////////////////////// … … 262 317 proc number_e (int n) 263 318 "USAGE: number_e(n); n integer 264 COMPUTE: exp(1) up to n decimal digits (no rounding)319 COMPUTE: Euler number e=exp(1) up to n decimal digits (no rounding) 265 320 by A.H.J. Sale's algorithm 266 321 RETURN: - string of exp(1) if no basering of char 0 is defined; … … 469 524 "USAGE: sort(id[v,o,n]); id=ideal/module/intvec/list (of intvec's or int's) 470 525 sort may be called with 1, 2 or 3 arguments in the following way: 471 - sort(id[v,n]); v=intvec , n=integer,526 - sort(id[v,n]); v=intvec of positive integers, n=integer, 472 527 - sort(id[o,n]); o=string (any allowed ordstr of a ring), n=integer 473 528 RETURN: a list of two elements: … … 488 543 (e.g. sort(id); sorts lexicographically, smaller int's come first) 489 544 WARNING: Since negative exponents create the 0 plynomial in 490 Singular, id should not contain negative integers: the result might491 not be as exspected545 Singular, id should not contain negative integers: the result 546 might not be as exspected 492 547 - if id=intvec: id is treated as list of integers 493 548 - if n!=0 the ordering is inverse, i.e. w.r.t. v(size(v)..1) 494 549 default: n=0 495 550 [2]: intvec, describing the permutation of the input (hence [2]=v if 496 v is given) 497 NOTE: If v is given, id may be any simply indexed object (e.g. any list); 551 v is given (with positive intergers) 552 NOTE: If v is given id may be any simply indexed object (e.g. any list or 553 string); if v[i]<0 and i<=size(id) v[i] is set internally to i; 498 554 entries of v must be pairwise distinct to get a permutation if id. 499 555 Zero generators of ideal/module are deleted … … 513 569 if ( ii != size(id) ) { v = sortvec(id); } 514 570 else { v = size(id)..1; } 515 if ( v == 0 ) { v = 1; }516 571 } 517 572 if ( size(#)>=1 and (typeof(id)=="ideal" or typeof(id)=="module") ) … … 567 622 } 568 623 s = size(v); 624 if( size(id) < s ) { s = size(id); } 569 625 def m = id; 570 for ( jj=1; jj<=s; jj=jj+1) { m[jj] = id[v[jj]]; } 626 if ( size(m) != 0 ) 627 { 628 for ( jj=1; jj<=s; jj=jj+1) 629 { 630 if ( v[jj]<=0 ) { v[jj]=jj; } 631 m[jj] = id[v[jj]]; 632 } 633 } 634 if ( v == 0 ) { v = 1; } 571 635 list L=m,v; 572 636 return(L);
Note: See TracChangeset
for help on using the changeset viewer.