1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952
|
-- -*- coding: utf-8 -*-
-- Copyright 1993-1999 by Daniel R. Grayson
document {
Key => identity,
Headline => "the identity function",
TT "identity x", " -- returns x.",
PARA{},
"This is the identity function."
}
document {
Key => symbol SPACE,
Headline => "blank operator; often used for function application, making polynomial rings",
SeeAlso =>(symbol SPACE, Function, Thing) -- not really a method
}
document {
Key => (symbol SPACE, Function, Thing),
Headline => "function application",
TT "f x", " -- yields the result of applying the function ", TT "f", " to ", TT "x", ".",
}
undocumented {
(symbol *, Number, RingElement),
(symbol *, RingElement, Number),
(symbol*, Number, InfiniteNumber),
(symbol*, InfiniteNumber, ZZ),
(symbol*, InfiniteNumber, QQ),
(symbol*, InfiniteNumber, RR),
(symbol*, ZZ, Ideal),
(symbol*, ZZ, GradedModuleMap),
(symbol*, InfiniteNumber, InfiniteNumber),
(symbol*, ZZ, Module),
(symbol*, ZZ, MonomialIdeal),
(symbol*, String),
(symbol*, ZZ, ChainComplexMap),
}
document {
Key => {symbol*,
(symbol*, Ring, Ideal),
(symbol*, MutableMatrix, MutableMatrix),
(symbol*, Ideal, Module),
(symbol*, Ring, RingElement),
(symbol *,Constant,Constant),
(symbol *,Constant,InexactNumber),
(symbol *,Constant,Number),
(symbol *,InexactNumber,Constant),
(symbol *,Matrix,Number),
(symbol *,Number,Constant),
(symbol *,Number,Matrix),
(symbol *,QQ,CC),
(symbol *,QQ,QQ),
(symbol *,QQ,RR),
(symbol *,QQ,ZZ),
(symbol *,RR,CC),
(symbol *,RR,QQ),
(symbol *,RR,RR),
(symbol *,RR,ZZ),
(symbol *,ZZ,CC),
(symbol *,ZZ,QQ),
(symbol *,ZZ,RR),
(symbol *,ZZ,ZZ),
(symbol *,CC,CC),
(symbol *,CC,QQ),
(symbol *,CC,RR),
(symbol *,CC,ZZ),
(symbol *, QQ, RRi),
(symbol *, RR, RRi),
(symbol *, RRi, QQ),
(symbol *, RRi, RR),
(symbol *, RRi, RRi),
(symbol *, RRi, ZZ),
(symbol *, ZZ, RRi),
(symbol*, GradedModuleMap, GradedModuleMap),
(symbol*, RingElement, Matrix),
(symbol*, RingMap, RingMap),
(symbol*, RingElement, MutableMatrix),
(symbol*, Ring, MonomialIdeal),
(symbol*, MonomialIdeal, MonomialIdeal),
(symbol*, RingElement, Ideal),
(symbol*, Matrix, Vector),
(symbol*, MonomialIdeal, Ring),
(symbol*, Ring, Vector),
(symbol*, RingElement, ChainComplexMap),
(symbol*, Ideal, Vector),
(symbol*, RingElement, MonomialIdeal),
(symbol*, Matrix, RingElement),
(symbol*, RingElement, Module),
(symbol*, RingElement, GradedModuleMap),
(symbol*, Ideal, Ring),
(symbol*, ChainComplexMap, ChainComplexMap),
(symbol*, RingElement, RingElement),
(symbol*, Thing, List),
(symbol*, List, Thing),
(symbol*, ZZ, ProjectiveHilbertPolynomial),
(symbol*, ProjectiveHilbertPolynomial, ZZ),
(symbol*, RingElement, Vector),
(symbol*, Number, Vector),
(symbol*, Vector, RingElement),
(symbol*, Vector, Number)
},
Headline => "a binary operator, usually used for multiplication",
Usage => "x * y",
"The return type depends on the types of x and y. If they have the
same type, then usually the return type is the common type of x and y.",
PARA{},
"Multiplication involving ring elements (including integers, rational numbers,
real and complex numbers), ideals, vectors, matrices, modules is
generally the usual multiplication, or composition of functions.",
PARA{},
"The intersection of sets is given by multiplication. See ", TO (symbol*,Set,Set), ".",
EXAMPLE {
"set{hi,you,there} * set{hi,us,here,you}"
},
PARA{},
"Multiplication involving a list attempts to multiply each element of the list.",
EXAMPLE {
"R = QQ[a..d];",
"a * {b,c,d}"
},
PARA{},
"Multiplication of matrices (", TO (symbol*,Matrix,Matrix),") or ring maps is the same as composition.",
EXAMPLE {
"f = map(R,R,{b,c,a,d})",
"g = map(R,R,{(a+b)^2,b^2,c^2,d^2})",
"f*g",
"(f*g)(a) == f(g(a))"
},
PARA{},
"Submodules of modules may be produced using multiplication and addition.",
EXAMPLE {
"M = R^2; I = ideal(a+b,c);",
"N = I*M + a*R^2",
"isHomogeneous N"
},
HEADER3 "Intervals",
PARA { "If one of the factors is an ", TO "RRi", ", the output is an interval containing all products of pairs in the factors." },
EXAMPLE {
"2*interval(1,3)",
"interval(1,3)*interval(-1,2)",
"interval(-1,1)*interval(-1,1)"
},
SeeAlso =>{ "times", "product"}
}
document {
Key => symbol &,
Headline => "a binary operator",
}
document {
Key => (symbol &, ZZ, ZZ),
Headline => "logical and",
Usage => "m & n",
Inputs => {"m", "n"},
Outputs => {
ZZ => {"obtained from the bits of the
integers ", TT "m", " and ", TT "n", " by logical 'and'."}
},
EXAMPLE "(2^15 + 2^13 + 2^42) & (2^15 + 2^23 + 2^42) == 2^15 + 2^42",
SeeAlso => {(symbol |,ZZ,ZZ),(symbol ^^,ZZ,ZZ), (symbol ~, ZZ)}
}
undocumented {
(symbol +, Number, RingElement),
(symbol +, RingElement, Number)
}
document {
Key => {symbol +,
(symbol +, ChainComplexMap, ChainComplexMap),
(symbol +, Number, InfiniteNumber),
(symbol +, ProjectiveHilbertPolynomial, ProjectiveHilbertPolynomial),
(symbol +, ZZ, ProjectiveHilbertPolynomial),
(symbol +, ProjectiveHilbertPolynomial, ZZ),
(symbol +, MonomialIdeal, MonomialIdeal),
(symbol +,CC),
(symbol +,CC,CC),
(symbol +,CC,QQ),
(symbol +,CC,RR),
(symbol +,CC,ZZ),
(symbol +,Constant),
(symbol +,Constant,Constant),
(symbol +,Constant,InexactNumber),
(symbol +,Constant,Number),
(symbol +,InexactNumber,Constant),
(symbol +,Number,Constant),
(symbol +,QQ),
(symbol +,QQ,CC),
(symbol +,QQ,QQ),
(symbol +,QQ,RR),
(symbol +,QQ,ZZ),
(symbol +,RR),
(symbol +,RR,CC),
(symbol +,RR,QQ),
(symbol +,RR,RR),
(symbol +,RR,ZZ),
(symbol +,ZZ),
(symbol +,ZZ,CC),
(symbol +,ZZ,QQ),
(symbol +,ZZ,RR),
(symbol +,ZZ,ZZ),
(symbol +, QQ, RRi),
(symbol +, RR, RRi),
(symbol +, RRi, QQ),
(symbol +, RRi, RR),
(symbol +, RRi),
(symbol +, RRi, RRi),
(symbol +, RRi, ZZ),
(symbol +, ZZ, RRi),
(symbol +, RingElement, GradedModuleMap),
(symbol +, Matrix, Number),
(symbol +, ZZ, ChainComplexMap),
(symbol +, ChainComplexMap, ZZ),
(symbol +, RingElement, RingElement),
(symbol +, InfiniteNumber, InfiniteNumber),
(symbol +, Ideal, RingElement),
(symbol +, RingElement, ChainComplexMap),
(symbol +, MutableMatrix, MutableMatrix),
(symbol +, Matrix, Matrix),
(symbol +, GradedModuleMap, GradedModuleMap),
(symbol +, InfiniteNumber, Number),
(symbol +, GradedModuleMap, RingElement),
(symbol +, Number, Matrix),
(symbol +, Vector),
(symbol +, Vector, Vector),
(symbol +, Matrix, RingElement),
(symbol +, RingElement, Matrix),
(symbol +, ChainComplexMap, RingElement)
},
Headline => "a unary or binary operator, usually used for addition",
Usage => "+y \n x+y",
"In most cases, this operator refers to standard addition.",
PARA{},
"In many cases, the integer 1 can be used as the identity, and scalars function as multiples
of the identity.
For example, the 1 below refers to the identity matrix
and the 2 to twice the identity matrix.",
EXAMPLE lines ///
M = matrix{{1,2,3},{2,3,4},{3,4,6}}
M+1, M+2
///,
HEADER3 "Intervals",
PARA { "If one of the addends is an ", TO "RRi", ", the output is an interval containing all sums of pairs in the addends." },
EXAMPLE {
"2+interval(1,3)",
"interval(1,3)+interval(-1,2)",
"interval(-1,1)+interval(-1,1)"
},
SeeAlso =>{ "plus", "sum"}
}
undocumented {
(symbol -, Number, RingElement),
(symbol -, RingElement, Number),
}
document {
Key => {symbol -,
(symbol -, ChainComplexMap, ChainComplexMap),
(symbol -, ProjectiveHilbertPolynomial, ProjectiveHilbertPolynomial),
(symbol -, ProjectiveHilbertPolynomial, ZZ),
(symbol -, ZZ, ProjectiveHilbertPolynomial),
(symbol -, Number, InfiniteNumber),
(symbol -, RingElement, GradedModuleMap),
(symbol -, GradedModuleMap),
(symbol -, Matrix, Number),
(symbol -, ProjectiveHilbertPolynomial),
(symbol -, RingElement),
(symbol -, RingElement, RingElement),
(symbol -, InfiniteNumber),
(symbol -, InfiniteNumber, InfiniteNumber),
(symbol -, RingElement, ChainComplexMap),
(symbol -, ChainComplexMap),
(symbol -, MutableMatrix, MutableMatrix),
(symbol -, Matrix, Matrix),
(symbol -, GradedModuleMap, GradedModuleMap),
(symbol -, InfiniteNumber, Number),
(symbol -, GradedModuleMap, RingElement),
(symbol -, Number, Matrix),
(symbol -, MutableMatrix),
(symbol -,CC),
(symbol -,CC,CC),
(symbol -,CC,QQ),
(symbol -,CC,RR),
(symbol -,CC,ZZ),
(symbol -,Constant),
(symbol -,Constant,Constant),
(symbol -,Constant,InexactNumber),
(symbol -,Constant,Number),
(symbol -,InexactNumber,Constant),
(symbol -,Number,Constant),
(symbol -,QQ),
(symbol -,QQ,CC),
(symbol -,QQ,QQ),
(symbol -,QQ,RR),
(symbol -,QQ,ZZ),
(symbol -,RR),
(symbol -,RR,CC),
(symbol -,RR,QQ),
(symbol -,RR,RR),
(symbol -,RR,ZZ),
(symbol -,ZZ),
(symbol -,ZZ,CC),
(symbol -,ZZ,QQ),
(symbol -,ZZ,RR),
(symbol -,ZZ,ZZ),
(symbol -, QQ, RRi),
(symbol -, RR, RRi),
(symbol -, RRi),
(symbol -, RRi, QQ),
(symbol -, RRi, RR),
(symbol -, RRi, RRi),
(symbol -, RRi, ZZ),
(symbol -, ZZ, RRi),
(symbol -, Matrix, RingElement),
(symbol -, Matrix),
(symbol -, RingElement, Matrix),
(symbol -, ChainComplexMap, RingElement),
(symbol -, Vector, Vector)
},
Headline => "a unary or binary operator, usually used for negation or subtraction",
Usage => "-y \n x-y",
"In most cases, this operator refers to standard negation or subtraction.",
PARA{},
"In many cases, the integer 1 can be used as the identity, and scalars function as multiples
of the identity.
For example, the 1 below refers to the identity matrix
and the 2 to twice the identity matrix.",
EXAMPLE lines ///
M = matrix{{1,2,3},{2,3,4},{3,4,6}}
M-1, M-2
///,
HEADER3 "Intervals",
PARA { "If one of the inputs is an ", TO "RRi", ", the output is an interval containing all differences of pairs in the inputs." },
EXAMPLE {
"2-interval(1,3)",
"interval(1,3)-interval(-1,2)",
"interval(-1,1)-interval(-1,1)"
},
SeeAlso =>{ "difference", "minus"}
}
undocumented {
(symbol /, InfiniteNumber, InfiniteNumber),
(symbol /, RingElement, Number),
(symbol /, Number, RingElement),
(symbol /, Number, InfiniteNumber),
(symbol /, InfiniteNumber, Number),
(symbol /, InfiniteNumber, RR),
(symbol /, EngineRing, Ideal),
(symbol /, List, SelfInitializingType)
}
document {
Key => {symbol /,
(symbol /,CC,CC),
(symbol /,CC,QQ),
(symbol /,CC,RR),
(symbol /,CC,ZZ),
(symbol /,QQ,CC),
(symbol /,QQ,QQ),
(symbol /,QQ,RR),
(symbol /,QQ,ZZ),
(symbol /,RR,CC),
(symbol /,RR,QQ),
(symbol /,RR,RR),
(symbol /,RR,ZZ),
(symbol /,ZZ,CC),
(symbol /,ZZ,QQ),
(symbol /,ZZ,RR),
(symbol /,ZZ,ZZ),
(symbol /, QQ, RRi),
(symbol /, RR, RRi),
(symbol /, RRi, QQ),
(symbol /, RRi, RR),
(symbol /, RRi, RRi),
(symbol /, RRi, ZZ),
(symbol /, ZZ, RRi)
},
Headline => "a binary operator, usually used for division",
Usage => "x / y",
"This operator is currently used in several ways in Macaulay2.",
UL {
"division in a ring, yielding a fraction",
"division in unevaluated expressions",
"quotient rings, modules and sheaves",
"applying a function or ring map to every element of a list or set"
},
EXAMPLE lines ///
2/3
2./3
///,
HEADER3 "Intervals",
PARA { "If one of the inputs is an ", TO "RRi", ", the output is an interval containing all quotients of pairs in the inputs." },
EXAMPLE {
"2/interval(1,3)",
"interval(-1,2)/interval(1,3)",
"interval(1,2)/interval(1,2)"
},
SeeAlso => { "//"}
}
doc ///
Key
(symbol /, Matrix, Number)
(symbol /, Matrix, RingElement)
(symbol /, Vector, Number)
(symbol /, Vector, RingElement)
Headline
scalar division
Usage
v / c
Inputs
v:{Matrix, Vector}
c:{Number, RingElement}
Outputs
:{Matrix, Vector}
Description
Text
This operation is equivalent to right scalar multiplication by the
multiplicative inverse of @CODE "c"@, i.e., @CODE "v * (1/c)"@.
Example
R = QQ[a,b,c,d]
matrix {{d, -b}, {-c, a}} / (a * d - b * c)
Caveat
The base ring of the output will be a field containing the base ring
of @CODE "v"@.
///
document {
Key => {symbol %,
(symbol %, CC, CC),
(symbol %, CC, QQ),
(symbol %, CC, RR),
(symbol %, CC, ZZ),
(symbol %, Number, RingElement),
(symbol %, QQ, QQ),
(symbol %, QQ, ZZ),
(symbol %, RingElement, Number),
(symbol %, RR, QQ),
(symbol %, RR, RR),
(symbol %, RR, ZZ),
(symbol %, Number, GroebnerBasis),
(symbol %, Number, Ideal),
(symbol %, ZZ, MonomialIdeal),
(symbol %, ZZ, ZZ)
},
Headline => "a binary operator, usually used for remainder and reduction",
Usage => "x % y",
"The usual meaning for this operator is remainder, or normal form with respect
to a Gröbner basis.",
PARA{},
"For integers, the remainder is non-negative.",
EXAMPLE lines ///
1232132141242345 % 1000000
(-4)%5
///,
PARA{},
"In polynomial rings, the division algorithm is used.",
EXAMPLE lines ///
A = ZZ[a,b]
(3*a^3-a*b-4) % (5*a-b)
pseudoRemainder(3*a^3-a*b-4, 5*a-b)
B = QQ[a,b]
(3*a^3-a*b-4) % (5*a-b)
///,
"In more complicated situations, Gröbner bases are usually needed. See ",
TO "methods for normal forms and remainder", ".",
SeeAlso => { remainder, remainder', pseudoRemainder, "//"}
}
document {
Key => {symbol //,(symbol //,ZZ,ZZ),
(symbol //, CC, CC),
(symbol //, CC, QQ),
(symbol //, CC, RR),
(symbol //, CC, ZZ),
(symbol //, InfiniteNumber, Number),
(symbol //, InfiniteNumber, RR),
(symbol //, Matrix, Number),
(symbol //, QQ, QQ),
(symbol //, Number, RingElement),
(symbol //, QQ, ZZ),
(symbol //, RingElement, Number),
(symbol //, RR, QQ),
(symbol //, RR, RR),
(symbol //, RR, ZZ),
(symbol //, Number, InfiniteNumber),
(symbol //, Number, Matrix),
(symbol //, ZZ, MonomialIdeal)
},
Headline => "a binary operator, usually used for quotient",
Usage => "x // y",
"For ring elements in the integers, polynomial rings, and other rings,
there are two types of division: exact division, whose result is often in a larger
field, such as the rationals or a function field, and division with remainder,
whose result is in the same ring. In Macaulay2, '/' denotes the first kind of division, while
'//' denotes the latter kind.
The following example shows
the difference between ", TO "//", " and ", TO "/", ".",
EXAMPLE lines ///
4/2
4//2
///,
EXAMPLE lines ///
R = QQ[x];
(x^2-3)//(x-1)
(x^2-3)%(x-1)
(x^2-3)/(x-1)
///,
SeeAlso => { "/", "%" }
}
document {
Key => symbol \,
Headline => "a binary operator",
}
document {
Key => symbol \\,
Headline => "a binary operator"
}
undocumented {
(symbol ^, InfiniteNumber, ZZ),
(symbol ^, InfiniteNumber, QQ),
(symbol ^, InfiniteNumber, RR),
(symbol ^, ZZ, InfiniteNumber),
(symbol ^, QQ, InfiniteNumber),
(symbol ^, RR, InfiniteNumber),
}
document {
Key => {symbol ^},
Headline => "a binary operator, usually used for powers",
Usage => "x ^ y",
PARA{},
"This operator is used for exponentiation, making free modules and sheaves,
for shifting complexes left or right, for projection maps involving direct sums,
and for making nets.",
}
document {
Key => {symbol !, (symbol !, ZZ), (symbol !, QQ), (symbol !, RR),(symbol !,Constant)},
Headline => "factorial",
Usage => "n!",
Inputs => {"n"=>ZZ},
Outputs => { ZZ => "n factorial, 1*2*3*...*n."},
EXAMPLE lines ///
30!
30.!
30.01!
///
}
document {
Key => "not",
Headline => "negation",
TT "not x", " -- yields the negation of x, which must be true or false.",
SeeAlso =>{ "and", "or" }
}
doc ///
Key
(symbol ~, ZZ)
Headline
logical not
Usage
n~
Inputs
n:ZZ
Outputs
:ZZ -- the bitwise complement of @TT "n"@
Description
Example
7~
Text
Note that @TT "~"@ has @TO2 {"precedence of operators",
"higher precedence"}@ than @TT "-"@, so enclose negative integers in
parentheses.
Example
(-12)~
SeeAlso
(symbol &, ZZ, ZZ)
(symbol |, ZZ, ZZ)
(symbol ^^, ZZ, ZZ)
///
document {
Key => symbol |,
Headline => "a binary operator, often used for horizontal concatenation",
SeeAlso => {"||"}
}
document {
Key => {(symbol |, List, List),
(symbol |, Array, Array),
(symbol |, Sequence, Sequence)},
Headline => "join lists, sequences or arrays",
Usage => "v|w",
Inputs => {"v" => Nothing => {ofClass List, ", ",
ofClass Array, ", or ",
ofClass Sequence},
"w" => Nothing => {"of the same type as ", TT "v"}},
Outputs => {
Nothing => "The join of the lists, sequences or arrays."},
EXAMPLE "{1,2,3}|{4,5,6}",
EXAMPLE "(a,b,c)|(1,2)",
SeeAlso => {join}
}
document {
Key => {(symbol |, Net, Net),
(symbol |, String, String),
(symbol |, String, ZZ),
(symbol |, ZZ, String)},
Headline => "join strings or nets",
TT "s|t", " -- concatenates strings or nets horizontally.",
PARA{},
"The result is a string if the arguments are all strings, otherwise it
is a net. The baselines of the nets are aligned.",
EXAMPLE {
///"abc" | "def"///,
///x = "abc" || "ABC"///,
///x|"x"|x///,
},
"If one of the two arguments is an integer, it is converted to a string first.",
EXAMPLE ///"t = " | 333///,
SeeAlso => {horizontalJoin}
}
document {
Key => (symbol |, ZZ, ZZ),
Headline => "logical or",
Usage => "m | n",
Inputs => {"m", "n"},
Outputs => {
ZZ => {"obtained from the bits of the
integers ", TT "m", " and ", TT "n", " by logical 'or'."}
},
EXAMPLE "2^42 | 2^15 == 2^42 + 2^15",
SeeAlso => {(symbol &,ZZ,ZZ),(symbol ^^,ZZ,ZZ), (symbol ~, ZZ)}
}
document {
Key => {(symbol |, Matrix, Matrix),
(symbol |, RingElement, Matrix),
(symbol |, Matrix, RingElement),
(symbol |, RingElement, RingElement),
(symbol |, Number, Matrix),
(symbol |, Matrix, Number)
},
Headline => "join matrices horizontally",
Usage => "f = g | h",
Inputs => {
"g" => {"a ", TT "m", " by ", TT "n", " matrix"},
"h" => {"a ", TT "m", " by ", TT "r", " matrix"}
},
Outputs => {
"f" => {"the ", TT "m", " by ", TT "n+r", " matrix,
obtained from matrices ", TT "g", " and ", TT "h", " by
concatenating the rows"}
},
EXAMPLE lines ///
R = ZZ[i..p];
g = matrix {{i,j},{k,l}}
h = matrix {{m,n},{o,p}}
f= g | h
///,
"If one of the arguments is a ring element or a number, then it
will be multiplied by a suitable identity matrix.",
EXAMPLE "f | (m-n)",
Caveat => {"It is assumed that the matrices ", TT "g", " and ", TT "h", " have the same ", TO Ring, "."},
SeeAlso =>{(symbol ||, Matrix, Matrix), (ring, Matrix)}
}
document {
Key => symbol ||,
Headline => "a binary operator, often used for vertical concatenation"
}
document {
Key => (symbol ||, Net, Net),
Headline => "join nets or strings vertically",
TT "m||n", " -- joins nets or strings by concatenating
them vertically. The baseline of the result is the baseline of the
first one.",
PARA{},
"In this example, we build a large net with arrows to indicate
the location of the baseline.",
EXAMPLE {
///x = "x" | "3"^1///,
///"<--- " | ( x || "" || x ) | " --->"///,
},
SeeAlso => {"stack"}
}
document {
Key => {(symbol ||, Matrix, Matrix),
(symbol ||, RingElement, Matrix),
(symbol ||, Matrix, RingElement),
(symbol ||, RingElement, RingElement),
(symbol ||, Matrix, Number),
(symbol ||, Number, Matrix)
},
Headline => "join matrices vertically",
Usage => "f = g || h",
Inputs => {
"g" => {"a ", TT "m", " by ", TT "n", " matrix."},
"h" => {"a ", TT "r", " by ", TT "n", " matrix."}
},
Outputs => {
"f" => {"the ", TT "m+r", " by ", TT "n", " matrix,
obtained from matrices ", TT "g", " and ", TT "h", " by
concatenating the columns."}
},
EXAMPLE lines ///
R = ZZ[i..p];
g = matrix {{i,j},{k,l}}
h = matrix {{m,n},{o,p}}
f= g || h
///,
"If one of the arguments is a ring element or a number, then it
will be multiplied by a suitable identity matrix.",
EXAMPLE "f || 33",
Caveat => {"It is assumed that the matrices ", TT "g", " and ", TT "h", " have the same ", TO Ring, "."},
SeeAlso =>{(symbol |, Matrix, Matrix), (ring, Matrix)}
}
document {
Key => (symbol ||, Vector, Vector),
Headline => "join Vectors ",
Usage => "v || w",
Inputs => {"v", "w"},
Outputs => {
Vector => {"obtained from vectors v and w by concatenating the columns."}
},
EXAMPLE lines ///
R = (ZZ[x,y,z])^3;
v = vector {1,x,x*y,x*z,x*y*z}
w = vector {z*x,z^2,3}
v || w
///,
PARA{},
SeeAlso => {(symbol ||, Matrix, Matrix)}
}
document {
Key => {(symbol===,Thing,Thing), symbol ===},
Headline => "strict equality",
Usage => "x === y",
Inputs => { "x", "y" },
Outputs => { Boolean => {"whether the expressions ", TT "x", " and ", TT "y", " are strictly equal"} },
PARA{
"Strictly equal expressions have the same type, so ", TT "0===0.", " and
", TT "0===0/1", " are false; the three types involved here are ",
TO "ZZ", ", ", TO "RR", ", and ", TO "QQ", "."
},
PARA{
"If x and y are ", TO "mutable", " then they are strictly equal only
if they are identical (i.e., at the same address in memory). For
details about why strict equality cannot depend on the contents of
mutable hash tables, see ", TO "hashing", ". On the other hand, if x
and y are non-mutable, then they are strictly equal if and only if
all their contents are strictly equal."
},
EXAMPLE { "{1,2,3} === {1,2,3}", "{1,2,3} === {2,1,3}" },
PARA {
"For some types, such as ring elements and matrices, strict equality is the same as mathematical equality.
This tends to be the case for objects for which not much computation is not required to test equality.
For certain other types, such as ", TO "Ideal", " or ", TO "Module", ", where extensive computations may
be required, the operator ", TO "==", " implements the desired comparison."
},
EXAMPLE {
"R = QQ[a..d];",
"a^2+b === b+a^2",
"ideal(a^2+b,c*d) === ideal(b+a^2,c*d+b+a^2)",
"matrix{{a,b,c}} === matrix{{a,b,c}}",
"matrix{{a,b,c}} === transpose matrix{{a},{b},{c}}"
},
PARA {
"As it happens, polynomial rings are mutable objects, and new ones are easily created, which are distinct from each other.
For example, the rings ", TT "A", " and ", TT "B", " below are not strictly equal."
},
EXAMPLE {
"A = QQ[x]; B = QQ[x];",
"A === B"
},
SeeAlso =>{ symbol==, symbol=!=, "operators" }
}
document {
Key => {symbol =!=, (symbol=!=,Thing,Thing)},
Headline => "strict inequality",
TT "x =!= y", " -- returns true or false depending on whether the expressions
x and y are strictly unequal.",
PARA{},
"See ", TO "===", " for details."
}
document {
Key => { symbol == },
Headline => "equality",
Usage => "x == y",
PARA {
"Returns true or false, depending on whether
the objects x and y are (mathematically) equal. The objects x and y are
typically numbers, elements of rings, matrices, modules, ideals,
chain complexes, and so on."
},
PARA {
"A test for mathematical equality will typically involve doing a computation
to see whether two representations of the same mathematical object are being
compared. For example, an ideal in a ring is represented by giving its
generators, and checking whether two sets of generators produce the same
ideal involves a computation with Gröbner bases. The ideals must be defined
in the same ring."
},
HEADER3 "Ideals",
EXAMPLE {
"R = QQ[a,b,c];",
"ideal(a^2-b,a^3) == ideal(b^2, a*b, a^2-b)"
},
PARA {
"Often mathematical objects can be tested to see if they are 0 or 1."
},
EXAMPLE {
"L = ideal(a^2-a-1,a^3+a+3)",
"L == 1",
"L == 0"
},
HEADER3 "Matrices",
PARA {
"Two ", TO "matrices", " are equal if their entries are equal, the source and target are
the same (including degrees), and the degree of the matrices are the same. In this example,
m and n have different source free modules."
},
EXAMPLE {
"m = matrix{{a,b},{c,a}}",
"n = map(R^2,R^2,m)",
"m == n",
"source m == source n"
},
PARA {
"If you only want to know if they have the same entries, test the difference against zero."
},
EXAMPLE {
"m-n == 0"
},
HEADER3 "Rings",
HEADER3 "Modules",
PARA {
"Two ", TO "modules", " are equal if they are isomorphic as subquotients of the
same ambient free module."
},
EXAMPLE {
"image matrix {{2,a},{1,5}} == R^2",
"image matrix {{2,a},{0,5}} == R^2"
},
HEADER3 "Intervals",
PARA { "If either side of the equality is an ", TO "RRi", ", the equality is an equality of sets." },
EXAMPLE {
"interval(1,3) == interval(1,3)",
"interval(1/2) == 1/2",
"interval(1/3) == 1/3"
},
PARA{
"It may happen that for certain types of objects, there is no method installed (yet)
for testing mathematical equality, in which case an error message will be
printed. A good alternative may be to test for strict equality with
the operator ", TO "===", "."
},
PARA {
"Since various sorts of mathematical objects are implemented as types, i.e., as
instances of ", TO "Type", ", there is no generic method for checking equality of types, so that
new mathematical comparison code can be provided in the future without breaking code that works."
},
Caveat => {
"Warning: whether this comparison operator returns true is not necessarily
related to whether the comparison operator ", TO symbol ?, " returns ", TT "symbol ==", "."
},
SeeAlso =>{ symbol!=, symbol===, symbol=!=, "operators" }
}
document {
Key => symbol !=,
Headline => "inequality",
TT "x != y", " -- the negation of ", TT "x == y", ".",
PARA{},
SeeAlso =>{ "==", "operators" }
}
undocumented {
(symbol**, QuotientRing, PolynomialRing),
(symbol**, QuotientRing, QuotientRing),
(symbol**, Number, Matrix),
(symbol**, Matrix, Number),
(symbol **,Number,RingElement),
(symbol **,RingElement,Matrix),
(symbol **,RingElement,Number),
(symbol **,RingElement,RingElement),
(symbol **,Thing,InexactFieldFamily),
(symbol**, PolynomialRing, PolynomialRing),
(symbol**, PolynomialRing, QuotientRing),
}
document {
Key => {symbol** },
Headline => "a binary operator, usually used for tensor product or Cartesian product",
SeeAlso => {symbol ^**}
}
document {
Key => symbol ^**,
Headline => "a binary operator, usually used for tensor or Cartesian power",
}
document {
Key => (symbol **, Set, Set),
Headline => "Cartesian product",
Usage => "x ** y",
Inputs => {
"x",
"y"
},
Outputs => {
Set => "whose elements are the sequences (a,b), where a is an element
of x, and b is an element of y."
},
EXAMPLE "set {1,2} ** set {a,b,c}",
"Suppose we wish to form the set of
all triples with entries either in the set A below.",
EXAMPLE {
"A = set{1,2}",
"A ** A ** A"
},
"To make this last a set of triples, ", TO splice, " each element together.
Or, use ", TO (symbol^**,VirtualTally,ZZ), ".",
EXAMPLE {
"(A ** A ** A)/splice",
"A^**3"
},
SeeAlso => { Set }
}
-- Local Variables:
-- compile-command: "make -C $M2BUILDDIR/Macaulay2/m2 "
-- End:
|