Jacal commands available at top level
#tex2html_wrap_inline1668#
<#227#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;The symbol #tex2html_wrap_inline1670# represents the last expression obtained by Jacal. It can
;SPMamp;be used in formulas like any other constant or variable or expression.
;SPMamp;<#227#>
e21: 5
e22 : 2
e22: 5
e23 : 3
e23: 25
#math10#;SPMlt; expr1 ;SPMgt; * ;SPMlt; expr2 ;SPMgt;
<#4#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;
;SPMamp;Multiplication of scalar expressions such as numbers, polynomials, rational
;SPMamp;functions and algebraic functions is denoted by the infix operator *. For
;SPMamp;example,
;SPMamp;<#4#>
e1 : (2+3*a)*4*a*b^2;
2 2
e1: (8 a + 12 a ) b
<#285#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;
;SPMamp;One can also use * as an infix operator on bunches. In that case, it
;SPMamp;operates componentwise, in an appropriate sense. In case the bunches are
;SPMamp;square matrices, the operator * multiplies corresponding entries of the
;SPMamp;two factors. It does not perform matrix multiplication. To multiply matrices
;SPMamp;one instead uses the operator <#5#>.<#5#> (i.e. a period). More generally, any binary
;SPMamp;scalar operator other than <#228#>ˆ<#228#> can be used on bunches and acts componentwise.
;SPMamp;<#285#>
#math11#;SPMlt; matrix1 ;SPMgt; #tex2html_wrap_inline1676# ;SPMlt; matrix2 ;SPMgt;
<#8#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;Matrix multiplication. <#8#>
e1 : a:[[1,2,3],[5,2,7]];
[1 2 3]
e1: [ ]
[5 2 7]
e2 : b:[[3,2],[6,4]];
[3 2]
e2: [ ]
[6 4]
e3 : b.a;
[13 10 23]
e3: [ ]
[26 20 46]
#math12#;SPMlt; expr1 ;SPMgt; + ;SPMlt; expr2 ;SPMgt;
<#9#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;
;SPMamp;Addition of scalar quantities or componentwise addition of bunches is accomplished
;SPMamp;by means of the infix operator +. For example,
;SPMamp;<#9#>
e2 : a:[[1,3,5],[2,4,7]];
[1 3 5]
e2: [ ]
[2 4 7]
e3 : b:[2,4];
e3: [2 , 4]
e4 : a+b;
[3 5 7 ]
e4: [ ]
[6 8 11]
e5 : 3+2;
e5: 5
e6 : c+b;
e6: [2 + c , 4 + c]
e7 : e1+e5;
2 2
e7: 5 + (8 a + 12 a ) b
<#10#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;<#10#>
#math13#;SPMlt; expr1 ;SPMgt; - ;SPMlt; expr2 ;SPMgt;
<#11#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;
;SPMamp;The symbol - is used to denote either the binary infix operator subtraction
;SPMamp;or the unary minus.
;SPMamp;<#11#>
e1 : -[1,2,3];
e1: [-1 , -2 , -3]
e2 : 3-7;
e2: -4
<#12#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;<#12#>
#math14#;SPMlt; expr1 ;SPMgt; ± ;SPMlt; expr2 ;SPMgt;
#math15#;SPMlt; expr1 ;SPMgt; #tex2html_wrap_inline1683# ;SPMlt; expr2 ;SPMgt;
<#229#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;Jacal allows the use of #tex2html_wrap_inline1685# and #tex2html_wrap_inline1687# as ambiguous signs
;SPMamp;(unary plus-or-minus, unary minus-or-plus) and as ambiguous infix
;SPMamp;operators (binary plus-or-minus, binary minus-or-plus). The value ±1
;SPMamp;is also represented by the constant <#13#>sqrt1<#13#>, while #tex2html_wrap_inline1690#1 is represented by
;SPMamp;#math16##tex2html_wrap_inline1692#.
;SPMamp;<#229#>
e7 : u:+/-3;
e7: 3 4
e8 : u^2;
e8: 9
e9 : +/-(u);
e9: 3
e10 : u-/+3;
e10: b-/+(3 5
#math17#;SPMlt; expr1 ;SPMgt; / ;SPMlt; expr2 ;SPMgt;
<#14#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;
;SPMamp;The symbol for division in Jacal is /. For example, the value returned by
;SPMamp;6/2; is 3.<#14#>
e3 : (x^2-y^2)/(x-y);
e3: x + y
<#15#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;<#15#>
#math18#;SPMlt; expr1 ;SPMgt; = ;SPMlt; expr2 ;SPMgt;
<#230#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;
;SPMamp;In Jacal, the equals sign #tex2html_wrap_inline1698# is <#16#>not<#16#> used for conditionals and it
;SPMamp;is <#17#>not<#17#> used for assignments. To assign one value to another, use
;SPMamp;either : or : =. The operator = merely returns a value of the form
;SPMamp;#math19#0 = ;SPMlt; expression ;SPMgt;. The value returned by a = b for example is 0 = a - b.
;SPMamp;<#230#>
e6 : 1=2;
e6: 0 = -1
;SPMlt; expr1 ;SPMgt;<#231#> ˆ <#231#>;SPMlt; expr2 ;SPMgt;
<#286#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;
;SPMamp;The infix operator <#232#>ˆ<#232#> is used for exponentiation of scalar quantitites or
;SPMamp;for componentwise exponentiation of bunches. For example, 25 returns 32.
;SPMamp;Unlike the other scalar infix operators, one cannot use <#233#>ˆ<#233#> for component-
;SPMamp;wise operations on bunches. Furthermore, one should not try to use <#234#>ˆ<#234#> to
;SPMamp;raise a square matrix to a power. Instead, one should use <#235#>ˆˆ<#235#>
;SPMamp;<#286#>
e7 : (1+x)^4;
2 3 4
e7: 1 + 4 x + 6 x + 4 x + x
;SPMlt; matrix ;SPMgt;<#236#> ˆˆ <#236#>;SPMlt; int ;SPMgt;
<#287#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;
;SPMamp;The infix operator <#237#>ˆˆ<#237#> is used for raising a square matrix
;SPMamp;to an integral power.It can also be used on nonsquare matrices, but the results
;SPMamp;are not documented.
;SPMamp;<#287#>
e8 : a:[[1,0],[-1,1]];
[1 0]
e8: [ ]
[-1 1]
e9 : a^^3;
[1 0]
e9: [ ]
[-3 1]
<#28#>batch(#math20#;SPMlt; filename ;SPMgt;)<#28#>
<#238#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;
;SPMamp;The command <#29#>batch<#29#> is used to read in a file containing programs written
;SPMamp;in Jacal. Here, #math21#;SPMlt; filename ;SPMgt; is a string in double quotes. The precise way in which
;SPMamp;one refers to a file is of course system dependent.
;SPMamp;<#238#>
e18 : system(;SPMquot;ex pluses;SPMquot;);
e18 : system(;SPMquot;ex pluses;SPMquot;);
;SPMquot;pluses;SPMquot; 3 lines, 19 characters
:1,#math22#d : aw : 2;x : 5;wx - xw;. : wq;SPMquot;pluses;SPMquot;3lines, 19characters
e18 : 0
e19 : batch(;SPMquot;pluses;SPMquot;);
e20 : e20 : 2
e21 : e21 : 5
e22 : e22 : 7
e23 : e19 :
#tex2html_wrap_inline1713#
#tex2html_wrap_inline1714#
[;SPMlt;elt_1;SPMgt;, ;SPMlt;elt_2;SPMgt;,..., ;SPMlt;elt_n;SPMgt;]#math23#
#tex2html_wrap_inline1716#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1717# ;SPMamp; TocollectanynumberofJacalobjectsintoabunch, simplyenclosethemin#tex2html_wrap_inline1718# ;SPMamp; squarebrackets.Forexample, tomakethebunchwhoseelementsare1, 2, 4, type#tex2html_wrap_inline1719# ;SPMamp; $[1, 2, 4]$.Onecanalsonestbunches, forexample,$[1,[[1, 3],[2, 5]],[1, 4]]$.#tex2html_wrap_inline1720# ;SPMamp; Notehoweverthatthebunchwhoseonlyelementis$#tex2html_wrap_inline1721##tex2html_wrap_inline1722#e3 : a : bunch(1, 2, 3);
e3 : [1, 2, 3]
e4 : b : [a];
e4 : [123]
e5 : c : [b];
e5 : [[1, 2, 3]]
e6 : [[[1, 2, 3]]];
e6 : [[1, 2, 3]]
#tex2html_wrap_inline1723##tex2html_wrap_inline1724#
#tex2html_wrap_inline1725#
#tex2html_wrap_inline1726#
#tex2html_wrap_inline1727#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1728# ;SPMamp; #tex2html_wrap_inline1729# ;SPMamp; Thecommand#tex2html_wrap_inline1730#isusedtodeterminethecoefficientofacertainpower#tex2html_wrap_inline1731# ;SPMamp; ofavariableinagivenpolynomial.Here#tex2html_wrap_inline1732#isapolynomialand#tex2html_wrap_inline1733##tex2html_wrap_inline1734# ;SPMamp; isavariable.Iftheoptionalthirdargumentisomitted, thenJacalreturns#tex2html_wrap_inline1735# ;SPMamp; thecoefficientofthevariable#tex2html_wrap_inline1736#in#tex2html_wrap_inline1737#.Otherwiseitreturns#tex2html_wrap_inline1738# ;SPMamp; thecoefficientof$#tex2html_wrap_inline1739##tex2html_wrap_inline1740#e14 : coeff ((x + 2)4, x, 3);
e14 : 8
e15 : (x + 2)4;
234e15 : 16 + 32x + 24x + 8x + x
e16 : coeff ((x + 2)4, x);
e16 : 32
e18 : coeffs((x + 2)4, x);
e18 : [16, 32, 24, 8, 1]
#tex2html_wrap_inline1741##tex2html_wrap_inline1742#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1743# ;SPMamp; Thefunction#tex2html_wrap_inline1744#providesaninversetothefunction#tex2html_wrap_inline1745#,#tex2html_wrap_inline1746# ;SPMamp; allowingonetorecoverapolynomialfromitslistofcoefficients.#tex2html_wrap_inline1747# ;SPMamp; #tex2html_wrap_inline1748##tex2html_wrap_inline1749#
#tex2html_wrap_inline1750#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1751# ;SPMamp; #tex2html_wrap_inline1752# ;SPMamp; Thecommand#tex2html_wrap_inline1753#isusedtoextractacolumnofamatrix.Here,#tex2html_wrap_inline1754# ;SPMamp; $ ;SPMlt; matrix ;SPMgt; $ isamatrixand$ ;SPMlt; integer ;SPMgt; $ isapositiveinteger.Ifthat#tex2html_wrap_inline1755# ;SPMamp; integerexceedsthenumberofcolumns, anerrormessagesuchas#tex2html_wrap_inline1756# ;SPMamp; #tex2html_wrap_inline1757# ;SPMamp; #tex2html_wrap_inline1758##tex2html_wrap_inline1759# ;SPMamp; #tex2html_wrap_inline1760# ;SPMamp; appears.Hereisanexampleofcorrectuseofthecommand#tex2html_wrap_inline1761#:#tex2html_wrap_inline1762# ;SPMamp; #tex2html_wrap_inline1763##tex2html_wrap_inline1764#e19 : a : [[1, 2, 4],[2, 5, 6]];
[124]e19 : [][256]
e20 : col (a, 2);
[2]e20 : [][5]#tex2html_wrap_inline1765##tex2html_wrap_inline1766#
#tex2html_wrap_inline1767#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1768# ;SPMamp; #tex2html_wrap_inline1769# ;SPMamp; Thecommand#tex2html_wrap_inline1770#producesalistofallofthecommandavailablein#tex2html_wrap_inline1771# ;SPMamp; Jacal.Itiscalledassfunctionofnoarguments.Explicitly:#tex2html_wrap_inline1772# ;SPMamp; #tex2html_wrap_inline1773# ;SPMamp; #tex2html_wrap_inline1774##tex2html_wrap_inline1775# ;SPMamp; #tex2html_wrap_inline1776##tex2html_wrap_inline1777#e21 : commands();
u - / + u + / - transposetranscriptdifferentialtermssystemsylvestershowsetscalarmatrixrowresultantrapplyquitqedpolydiscriminantpolyornumnegatemodminormatrixloadlistofvarsidentgenmatrixgcdfinvfactorexampleeliminatedotproductdividediffdiagmatrixdeterminantdescribedenomcrossproductcontentcommandscolcoeffscoeffbunchbatchb + / - =/ - + *6
#tex2html_wrap_inline1778##tex2html_wrap_inline1779#
#tex2html_wrap_inline1780#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1781# ;SPMamp; #tex2html_wrap_inline1782# ;SPMamp; Returnsalistofcontentandprimitivepartofapolynomialwith#tex2html_wrap_inline1783# ;SPMamp; respecttothevariable.ThecontentistheGCDofthecoefficients#tex2html_wrap_inline1784# ;SPMamp; ofthepolynomialinthevariable.Theprimitivepartis$ ;SPMlt; poly ;SPMgt; $ divided#tex2html_wrap_inline1785# ;SPMamp; bythecontent#tex2html_wrap_inline1786# ;SPMamp; #tex2html_wrap_inline1787##tex2html_wrap_inline1788#
e24 : content(2*x*y + 4*x2*y2, y);
2e24 : [2x, y + 2xy]#tex2html_wrap_inline1789##tex2html_wrap_inline1790#
#tex2html_wrap_inline1791#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1792# ;SPMamp; #tex2html_wrap_inline1793# ;SPMamp; TheJacalcommand#tex2html_wrap_inline1794#computesthecrossproductoftwovectors.#tex2html_wrap_inline1795# ;SPMamp; Bydefinition, thetwovectorsmusteachhavethreecomponents.#tex2html_wrap_inline1796# ;SPMamp; #tex2html_wrap_inline1797##tex2html_wrap_inline1798#e24 : [2x, y + 2xy]
e25 : crossproduct([1, 2, 3],[4, 2, 5]);
e25 : [4, 7, -6]
#tex2html_wrap_inline1799##tex2html_wrap_inline1800#
#tex2html_wrap_inline1801#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1802# ;SPMamp; #tex2html_wrap_inline1803# ;SPMamp; TheJacalcommand#tex2html_wrap_inline1804#isusedtoobtainthedenominatorofarational#tex2html_wrap_inline1805# ;SPMamp; expression.#tex2html_wrap_inline1806# ;SPMamp; #tex2html_wrap_inline1807##tex2html_wrap_inline1808#e26 : denom(4/5);
e26 : 5
#tex2html_wrap_inline1809##tex2html_wrap_inline1810#
#tex2html_wrap_inline1811#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1812# ;SPMamp; #tex2html_wrap_inline1813# ;SPMamp; Thecommand#tex2html_wrap_inline1814#istheheartoftheonlinehelpfacilityofJacal.#tex2html_wrap_inline1815# ;SPMamp; Here,$ ;SPMlt; command ;SPMgt; $ isastringwhichisthenameofacommandand#tex2html_wrap_inline1816##tex2html_wrap_inline1817# ;SPMamp; producesabriefdescriptionofthecommandandinmanycasesincludes#tex2html_wrap_inline1818# ;SPMamp; anexampleofitsuse.Togetherwiththecommand#tex2html_wrap_inline1819#, whichprints#tex2html_wrap_inline1820# ;SPMamp; alistofallavailableJacalcommands, andthecommand#tex2html_wrap_inline1821#, which#tex2html_wrap_inline1822# ;SPMamp; givesanexampleoftheuseofthecommand, onecaninprincipleuseJacalwithout#tex2html_wrap_inline1823# ;SPMamp; amanualafteronehaslearnedhowtogetstarted.#tex2html_wrap_inline1824# ;SPMamp; #tex2html_wrap_inline1825##tex2html_wrap_inline1826#e27 : describe(col );column.columnofamatrixe27 : describe(resultant);resultant.Theresultofeliminatingavariablebetween2equations(orpolynomials).e27 : describe(+);Addition, plus.a + b
#tex2html_wrap_inline1827##tex2html_wrap_inline1828#
#tex2html_wrap_inline1829#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1830# ;SPMamp; #tex2html_wrap_inline1831# ;SPMamp; TheJacalcommand#tex2html_wrap_inline1832#computesthedeterminantofasquarematrix.#tex2html_wrap_inline1833# ;SPMamp; Attemptingtotakethedeterminantofanon-squarematrixwillproduceanerror#tex2html_wrap_inline1834# ;SPMamp; message.#tex2html_wrap_inline1835# ;SPMamp; #tex2html_wrap_inline1836##tex2html_wrap_inline1837#e1 : a : [[1, 2],[6, 7]];
[12]e1 : [][67]
e2 : determinant(a);
e2 : - 5
#tex2html_wrap_inline1838##tex2html_wrap_inline1839#
#tex2html_wrap_inline1840#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1841# ;SPMamp; #tex2html_wrap_inline1842# ;SPMamp; TheJacalcommand#tex2html_wrap_inline1843#takesasinputalistof#tex2html_wrap_inline1844# ;SPMamp; objectsandreturnsthediagonalmatrixhavingthoseobjects#tex2html_wrap_inline1845# ;SPMamp; asdiagonalentries.Incaseonewantsallofthediagonalentries#tex2html_wrap_inline1846# ;SPMamp; tobeequal, itismoreconvenienttousethecommand#tex2html_wrap_inline1847#.#tex2html_wrap_inline1848# ;SPMamp; #tex2html_wrap_inline1849##tex2html_wrap_inline1850#e3 : diagmatrix(12, 3, a, s2);
[12000][][0300]e3 : [][00a0][][0002][s]
e4 : diagmatrix([1, 2], 2);
[[1, 2]0]e4 : [][02]
#tex2html_wrap_inline1851##tex2html_wrap_inline1852#
#tex2html_wrap_inline1853#
#tex2html_wrap_inline1854#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1855# ;SPMamp; #tex2html_wrap_inline1856# ;SPMamp; Thecommand#tex2html_wrap_inline1857#treats#tex2html_wrap_inline1858#and#tex2html_wrap_inline1859#aspolynomials#tex2html_wrap_inline1860# ;SPMamp; inthevariable#tex2html_wrap_inline1861#andreturnsapair$#tex2html_wrap_inline1862##tex2html_wrap_inline1863#e5 : divide(x2 + y2, x - 7*y2, x);
224e5 : [x + 7y, y + 49y]
e6 : divide(- 7, 3);
e6 : [- 2, -1]
e11 : divide(x2 + y2 + z2, x + y + z);
22e11 : [- x - y + z, 2x + 2xy + 2y]
e14 : divide(x2 + y2 + z2, x + y + z, y);
22e14 : [- x + y - z, 2x + 2xz + 2z]
e15 : divide(x2 + y2 + z2, x + y + z, z);
22e15 : [- x - y + z, 2x + 2xy + 2y]
#tex2html_wrap_inline1864##tex2html_wrap_inline1865#
#tex2html_wrap_inline1866#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1867# ;SPMamp; #tex2html_wrap_inline1868# ;SPMamp; TheJacalfunction#tex2html_wrap_inline1869#returnsthedotproductoftworowvectors#tex2html_wrap_inline1870# ;SPMamp; ofthesamelength.Itwillalsogivethedotproductoftwomatricesofthe#tex2html_wrap_inline1871# ;SPMamp; samesizebycomputingthesumofthedotproductsofthecorresponding#tex2html_wrap_inline1872# ;SPMamp; rowsor, whatisthesame, thetraceofonematrixtimesthetransposeof#tex2html_wrap_inline1873# ;SPMamp; theotherone.#tex2html_wrap_inline1874# ;SPMamp; #tex2html_wrap_inline1875##tex2html_wrap_inline1876#e28 : a : [1, 2, 3];b : [3, 1, 5];
e28 : [1, 2, 3]
e29 : e29 : [3, 1, 5]
e30 : dotproduct(a, b);
e30 : 20
#tex2html_wrap_inline1877##tex2html_wrap_inline1878#
#tex2html_wrap_inline1879#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1880# ;SPMamp; #tex2html_wrap_inline1881# ;SPMamp; Here$ ;SPMlt; eqni ;SPMgt; $ isanequationfor$i=1,..., n$ andwhere$ ;SPMlt; varj ;SPMgt; $ isavariable#tex2html_wrap_inline1882# ;SPMamp; for$j=1,..., m$.#tex2html_wrap_inline1883#returnsalistofequationsobtainedbyeliminatingthe#tex2html_wrap_inline1884# ;SPMamp; variables$ ;SPMlt; var1 ;SPMgt; , dots, ;SPMlt; varm ;SPMgt; $ fromtheequations$ ;SPMlt; eqn1 ;SPMgt; ,..., ;SPMlt; eqnn ;SPMgt; $.#tex2html_wrap_inline1885# ;SPMamp; #tex2html_wrap_inline1886##tex2html_wrap_inline1887#
e39 : eliminate([x2 + y = 0, x3 + y = 0],[x]);
2e39 : 0 = - y - y
e40 : eliminate([x + y + z = 3, x2 + y2 + z2 = 3, x3 + y3 + z3 = 3],[x, y]);
e40 : 0 = 1 - z
#tex2html_wrap_inline1888##tex2html_wrap_inline1889#
#tex2html_wrap_inline1890#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1891# ;SPMamp; #tex2html_wrap_inline1892# ;SPMamp; Here,$ ;SPMlt; command ;SPMgt; $ isastringwhichisthenameofaJacalcommand.#tex2html_wrap_inline1893##tex2html_wrap_inline1894# ;SPMamp; #tex2html_wrap_inline1895#givesanexampleoftheuseofthecommand.Seealsothefunction#tex2html_wrap_inline1896##tex2html_wrap_inline1897# ;SPMamp; #tex2html_wrap_inline1898##tex2html_wrap_inline1899#
e43:example(+);a+b
e43:a+b
#tex2html_wrap_inline1900# ;SPMamp; #tex2html_wrap_inline1901##tex2html_wrap_inline1902#
#tex2html_wrap_inline1903#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1904# ;SPMamp; #tex2html_wrap_inline1905# ;SPMamp; TheJacalcommand#tex2html_wrap_inline1906#takesasinputanintegerandreturns#tex2html_wrap_inline1907# ;SPMamp; alistoftheprimenumbersthatdivideit, eachoccurringwiththeappropriate#tex2html_wrap_inline1908# ;SPMamp; multiplicityinthelist.Ifthenumberisnegative, thelistwillbegin#tex2html_wrap_inline1909# ;SPMamp; with$-1$.#tex2html_wrap_inline1910##tex2html_wrap_inline1911#
e45 : factor(120);
e45 : [2, 2, 2, 3, 5]
e46 : factor(- 120);
e46 : [- 1, 2, 2, 2, 3, 5]
#tex2html_wrap_inline1912##tex2html_wrap_inline1913#
;SPMlt;function;SPMgt;#math24##tex2html_wrap_inline1915#
#tex2html_wrap_inline1916#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1917# ;SPMamp; #tex2html_wrap_inline1918# ;SPMamp; Thecommand#tex2html_wrap_inline1919#takesasinputafunctionofonevariable#tex2html_wrap_inline1920# ;SPMamp; andreturnstheinverseofthatfunction.Thefunctionmaybedefined#tex2html_wrap_inline1921# ;SPMamp; inanyofthewayspermittedinJacal, i.e.byanexplicitalgebraic#tex2html_wrap_inline1922# ;SPMamp; definition, byanexplicitlambdaexpressionorbyanimplicitlamba#tex2html_wrap_inline1923# ;SPMamp; expression.If$f$ isthefunction, thentyping$f$#tex2html_wrap_inline1924#has#tex2html_wrap_inline1925# ;SPMamp; thesameeffectastyping#tex2html_wrap_inline1926#.#tex2html_wrap_inline1927# ;SPMamp; #tex2html_wrap_inline1928##tex2html_wrap_inline1929#e0 : w(t) : = t + 1;
w(t) : lambda([@1], 1 + @1)
e0 : finv(w);
e0 : lambda([@1], -1 + @1)#tex2html_wrap_inline1930##tex2html_wrap_inline1931#
#tex2html_wrap_inline1932#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1933# ;SPMamp; #tex2html_wrap_inline1934# ;SPMamp; TheJacalfunction#tex2html_wrap_inline1935#takesasargumentstwopolynomialswithinteger#tex2html_wrap_inline1936# ;SPMamp; coefficientsandreturnsagreatestcommondivisorofthetwopolynomials.This#tex2html_wrap_inline1937# ;SPMamp; includesthecasewherethepolynomialsareintegers.#tex2html_wrap_inline1938# ;SPMamp; #tex2html_wrap_inline1939##tex2html_wrap_inline1940#e1 : gcd (x4 - y4, x6 + y6);
22e1 : x + y
e2 : gcd (4, 10);
e2 : 2
#tex2html_wrap_inline1941##tex2html_wrap_inline1942#
#tex2html_wrap_inline1943#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1944# ;SPMamp; Thefunction#tex2html_wrap_inline1945#takesasargumentsafunction$ ;SPMlt; function ;SPMgt; $ oftwo#tex2html_wrap_inline1946# ;SPMamp; variablesandtwopositiveintegers,$ ;SPMlt; rows ;SPMgt; $ and$ ;SPMlt; cols ;SPMgt; $.Itreturnsa#tex2html_wrap_inline1947# ;SPMamp; matrixwiththeindicatednumbersofrowsandcolumnsinwhichthe$(i, j)$th#tex2html_wrap_inline1948# ;SPMamp; entryisobtainedbyevaluating$ ;SPMlt; function ;SPMgt; $ at$(i, j)$.Thefunctionmaybe#tex2html_wrap_inline1949# ;SPMamp; definedinanyofthewaysavailableinJacal, i.epreviouslybyanexplicit#tex2html_wrap_inline1950# ;SPMamp; algebraicdefinition, byanexplicitlambdaexpressionorbyanimplicitlambda#tex2html_wrap_inline1951# ;SPMamp; expression.#tex2html_wrap_inline1952# ;SPMamp; #tex2html_wrap_inline1953##tex2html_wrap_inline1954#e4 : @12 + @22;
22e4 : lambda([@1,@2],@1 + @2)
e5 : genmatrix(e4, 3, 5);
[25101726][]e5 : [58132029][][1013182534]
#tex2html_wrap_inline1955##tex2html_wrap_inline1956#
#tex2html_wrap_inline1957#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1958# ;SPMamp; #tex2html_wrap_inline1959# ;SPMamp; Thecommand#tex2html_wrap_inline1960#takesasargumentapositiveinteger$n$#tex2html_wrap_inline1961# ;SPMamp; andreturnsan$n×n$ identitymatrix.Thisissometimesmoreconvenient#tex2html_wrap_inline1962# ;SPMamp; thanobtainingthissamematrixusingthecommand#tex2html_wrap_inline1963#.#tex2html_wrap_inline1964# ;SPMamp; #tex2html_wrap_inline1965##tex2html_wrap_inline1966#
e6 : ident(4);
[1000][][0100]e6 : [][0010][][0001]
#tex2html_wrap_inline1967##tex2html_wrap_inline1968#
#tex2html_wrap_inline1969#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1970# ;SPMamp; Jacalhastheabilitytoworkwithlambdaexpressions, viathecommand#tex2html_wrap_inline1971# ;SPMamp; #tex2html_wrap_inline1972#.Furthermore, Jacalalwaysconvertsuserdefinitionsoffunctions#tex2html_wrap_inline1973# ;SPMamp; byanymethodintolambdaexpressionsandconvertsthedummyvariablesofthe#tex2html_wrap_inline1974# ;SPMamp; functiondefinitionintosymbolssuchas#tex2html_wrap_inline1975#,....Jacalcanmanipulate#tex2html_wrap_inline1976# ;SPMamp; lambdaexpressionsbymanipulatingtheirfunctionparts, asin#tex2html_wrap_inline1977#below.#tex2html_wrap_inline1978# ;SPMamp; Jacalcanalsoinvertafunctionusingthecommand#tex2html_wrap_inline1979#.#tex2html_wrap_inline1980##tex2html_wrap_inline1981#
e12 : lambda([x], x2);
2e12 : lambda([@1],@1)
e13 : lambda([x, y, z], x*y*z);
e13 : lambda([@1,@2,@3],@1@2@3)
e14 : e12 + e13;
2e14 : lambda([@1,@2,@3],@1 + @1@2@3)
#tex2html_wrap_inline1982##tex2html_wrap_inline1983#
#tex2html_wrap_inline1984#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1985# ;SPMamp; #tex2html_wrap_inline1986# ;SPMamp; Thecommand#tex2html_wrap_inline1987#takesasinputarationalexpressionandreturns#tex2html_wrap_inline1988# ;SPMamp; alistofthevariablesthatoccurinthatexpression.#tex2html_wrap_inline1989# ;SPMamp; #tex2html_wrap_inline1990##tex2html_wrap_inline1991#
e7 : listofvars(x2 + y3);
e7 : [x, y]
e8 : listofvars((x2 + y3)/(2*x7 + y*x + z));
e8 : [z, x, y]
#tex2html_wrap_inline1992##tex2html_wrap_inline1993#
#tex2html_wrap_inline1994#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline1995# ;SPMamp; #tex2html_wrap_inline1996# ;SPMamp; Thejacalcommand#tex2html_wrap_inline1997#takesasinputastringandreadsina#tex2html_wrap_inline1998#file#tex2html_wrap_inline1999# ;SPMamp; whosenameisobtainedbyappendingtheextension#tex2html_wrap_inline2000#tothestring.#tex2html_wrap_inline2001# ;SPMamp; IfyouwanttoreadinafileofJacalcommands, donotuse#tex2html_wrap_inline2002#.Instead#tex2html_wrap_inline2003# ;SPMamp; usethecommand#tex2html_wrap_inline2004#.Toloadinthefile#tex2html_wrap_inline2005#,#tex2html_wrap_inline2006# ;SPMamp; #tex2html_wrap_inline2007##tex2html_wrap_inline2008#e9 : load (;SPMquot;foo;SPMquot;);
e9 : foo
#tex2html_wrap_inline2009#minor(;SPMlt;matrix;SPMgt;,;SPMlt;row;SPMgt;,;SPMlt;col;SPMgt;);#math25#
#tex2html_wrap_inline2011#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2012# ;SPMamp; #tex2html_wrap_inline2013# ;SPMamp; Thecommand#tex2html_wrap_inline2014#returnsthesubmatrixof$ ;SPMlt; matrix ;SPMgt; $ obtainedby#tex2html_wrap_inline2015# ;SPMamp; deletingthe$i$throwandthe$j$thcolumn, where$i= ;SPMlt; row ;SPMgt; $ and$j= ;SPMlt; col ;SPMgt; $.#tex2html_wrap_inline2016# ;SPMamp; #tex2html_wrap_inline2017##tex2html_wrap_inline2018#
e21 : b : [[1, 2, 3],[3, 1, 5],[5, 2, 7]];
[123][]e21 : [315][][527]
e22 : minor(b, 3, 1);
[23]e22 : [][15]
#tex2html_wrap_inline2019##tex2html_wrap_inline2020#
#tex2html_wrap_inline2021#
#tex2html_wrap_inline2022#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2023# ;SPMamp; #tex2html_wrap_inline2024# ;SPMamp; Thefunction#tex2html_wrap_inline2025#takesasinputstwointegersandreturnsthe#tex2html_wrap_inline2026# ;SPMamp; anintegerwhichiscongruenttothefirstmodulothesecond.Itcan#tex2html_wrap_inline2027# ;SPMamp; alsoreduceapolynomialwithrespecttoagivenequation.#tex2html_wrap_inline2028# ;SPMamp; #tex2html_wrap_inline2029##tex2html_wrap_inline2030#
e23 : mod (5, 2);
e23 : - 1
e24 : mod (x4 +4, x2 = 2);
e24 : 8
#tex2html_wrap_inline2031##tex2html_wrap_inline2032#
#tex2html_wrap_inline2033#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2034# ;SPMamp; #tex2html_wrap_inline2035# ;SPMamp; Thefunction#tex2html_wrap_inline2036#takesarationalexpressionasinputandreturnsa#tex2html_wrap_inline2037# ;SPMamp; numeratoroftheexpression.#tex2html_wrap_inline2038# ;SPMamp; #tex2html_wrap_inline2039##tex2html_wrap_inline2040#
e25 : num((x2 + y2)/(x2 - y2));
22e25 : - x - y
e26 : num(7/4);
e26 : 7
e27 : num(7/(4/3));
e27 : 21
#tex2html_wrap_inline2041##tex2html_wrap_inline2042#
#tex2html_wrap_inline2043#
#tex2html_wrap_inline2044#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2045# ;SPMamp; #tex2html_wrap_inline2046# ;SPMamp; Thefunction#tex2html_wrap_inline2047#takesasinputseithertwoequationsortwovalues.Ifthe#tex2html_wrap_inline2048# ;SPMamp; inputsaretwoequations, then#tex2html_wrap_inline2049#returnsanequationwhichisequivalent#tex2html_wrap_inline2050# ;SPMamp; totheassertionthatatleastoneofthetwoinputequationsholds.Ifthe#tex2html_wrap_inline2051# ;SPMamp; inputsto#tex2html_wrap_inline2052#aretwovaluesinsteadoftwoequations, thenthefunction#tex2html_wrap_inline2053# ;SPMamp; #tex2html_wrap_inline2054#returnsamultiplevalue.Iftheinputsto#tex2html_wrap_inline2055#consistof#tex2html_wrap_inline2056# ;SPMamp; oneequationandonevalue, then#tex2html_wrap_inline2057#willreturnthevalue.#tex2html_wrap_inline2058# ;SPMamp; #tex2html_wrap_inline2059##tex2html_wrap_inline2060#e1 : or(x = 2, y = 3);
e1 : 0 = - 6 + 3x + (2 - x)y
e2 : or(2, 3);
2e2 : :@| 0=-6+5:@-:@
e3 : e22;
2e3 : :@| 0=-36+13:@-:@
e4 : or(x = 2, 17);
e4 : 17
#tex2html_wrap_inline2061##tex2html_wrap_inline2062#
#tex2html_wrap_inline2063#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2064# ;SPMamp; #tex2html_wrap_inline2065# ;SPMamp; Here$ ;SPMlt; poly ;SPMgt; $ isapolynomialand$ ;SPMlt; var ;SPMgt; $ isavariable.Thisfunctionreturns#tex2html_wrap_inline2066# ;SPMamp; thesquareoftheproductofthedifferencesoftherootsofthepolynomial$ ;SPMlt; poly ;SPMgt; $#tex2html_wrap_inline2067# ;SPMamp; withrespecttothevariable$ ;SPMlt; var ;SPMgt; $.#tex2html_wrap_inline2068# ;SPMamp; #tex2html_wrap_inline2069##tex2html_wrap_inline2070#e7 : polydiscriminant(x3 -1, x);
e7 : - 27
#tex2html_wrap_inline2071##tex2html_wrap_inline2072#
#tex2html_wrap_inline2073#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2074# ;SPMamp; #tex2html_wrap_inline2075# ;SPMamp; Thecommand#tex2html_wrap_inline2076#isprobablythemostimportantcommandyouneedtoknow#tex2html_wrap_inline2077# ;SPMamp; whenusingJacal, sinceitisthecommandthatlet'syouexitfromJacal.It#tex2html_wrap_inline2078# ;SPMamp; doesnothowever, returnyoutotheoperatingsystem.InsteaditsuspendsJacal#tex2html_wrap_inline2079# ;SPMamp; andreturnsyoutotheunderlyinglisp.YoucanreturntotheJacalsessionwhere#tex2html_wrap_inline2080# ;SPMamp; youleftoffbysimplytyping#tex2html_wrap_inline2081#.Thisallowsyoutodosomeprogramming#tex2html_wrap_inline2082# ;SPMamp; intheunderlyinglispbeforereturningtoJacal.Ifyoudonotwishtoreturnto#tex2html_wrap_inline2083# ;SPMamp; Jacalbutreallywanttoterminatethesessionandreturntotheoperatingsystem,#tex2html_wrap_inline2084# ;SPMamp; thenaftertyping#tex2html_wrap_inline2085#, youmustthentypewhatevercommandisusedto#tex2html_wrap_inline2086# ;SPMamp; exitfromtheunderlyinglisptotheoperatingsystem.In#tex2html_wrap_inline2087#, thecommand#tex2html_wrap_inline2088# ;SPMamp; is#tex2html_wrap_inline2089#.Iftheunderlyinglispusesthecommand#tex2html_wrap_inline2090#toreturn#tex2html_wrap_inline2091# ;SPMamp; toheoperatingsystem, thenonecanexitdirectlyfromJacaltotheoperating#tex2html_wrap_inline2092# ;SPMamp; systemwithoutusing#tex2html_wrap_inline2093#bysimplytyping#tex2html_wrap_inline2094#.#tex2html_wrap_inline2095# ;SPMamp; #tex2html_wrap_inline2096##tex2html_wrap_inline2097#unix ;SPMgt; jacal
JACALversion1a0, Copyright1989, 1990, 1991, 1992AubreyJafferJACALcomeswithABSOLUTELYNOWARRANTY;fordetailstype`(terms)'.Thisisfreesoftware, andyouarewelcometoredistributeitundercertainconditions;type`(terms)'fordetails.;;;Type(math)tobegin. ;SPMgt; (math)typeqed ()toreturntoschemee1 : qed ();scheme ;SPMgt; (quit)unix ;SPMgt; jacal
JACALversion1a0, Copyright1989, 1990, 1991, 1992AubreyJafferJACALcomeswithABSOLUTELYNOWARRANTY;fordetailstype`(terms)'.Thisisfreesoftware, andyouarewelcometoredistributeitundercertainconditions;type`(terms)'fordetails.;;;Type(math)tobegin. ;SPMgt; (math)typeqed ()toreturntoschemee1 : qed ();scheme ;SPMgt; (math)typeqed ()toreturntoschemee2 : quit();unix ;SPMgt;
#tex2html_wrap_inline2098##tex2html_wrap_inline2099#
#tex2html_wrap_inline2100#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2101# ;SPMamp; #tex2html_wrap_inline2102# ;SPMamp; See:#tex2html_wrap_inline2103##tex2html_wrap_inline2104# ;SPMamp; #tex2html_wrap_inline2105##tex2html_wrap_inline2106#
#tex2html_wrap_inline2107#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2108# ;SPMamp; #tex2html_wrap_inline2109# ;SPMamp; Thefunction#tex2html_wrap_inline2110#isusedtoaccesselementsofbunches.Itcanalso#tex2html_wrap_inline2111# ;SPMamp; accesselementsnestedatlowerlevelsinabunch.Inparticular, itcanalso#tex2html_wrap_inline2112# ;SPMamp; accessmatrixelements.Intheabovesyntax,$ ;SPMlt; bunch ;SPMgt; $ isthebunchwhoseparts#tex2html_wrap_inline2113# ;SPMamp; onewishestoaccess, and$n, ;SPMlt; int1 ;SPMgt; , ;SPMlt; int2 ;SPMgt; ,..., ;SPMlt; intn ;SPMgt; $ arepositiveintegers.#tex2html_wrap_inline2114# ;SPMamp; Itreturnsthe$ ;SPMlt; intn ;SPMgt; $-thelementofthe$ ;SPMlt; intn-1 ;SPMgt; $-thelementof...ofthe#tex2html_wrap_inline2115# ;SPMamp; $ ;SPMlt; int2 ;SPMgt; $-thelementofthe$ ;SPMlt; int1 ;SPMgt; $-thelementof$ ;SPMlt; bunch ;SPMgt; $.Onecanhave$n=0$.#tex2html_wrap_inline2116# ;SPMamp; Inthatcase,#tex2html_wrap_inline2117#simplyreturnsthebunch.#tex2html_wrap_inline2118# ;SPMamp; #tex2html_wrap_inline2119##tex2html_wrap_inline2120#e2 : rapply([[1, 2, 3],[1, 4, 6], 3], 2, 3);
e2 : 6
e6 : rapply([a, b], 2);
e6 : b
e7 : rapply([a, b]);
e7 : [a, b]
#tex2html_wrap_inline2121##tex2html_wrap_inline2122#
#tex2html_wrap_inline2123#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2124# ;SPMamp; #tex2html_wrap_inline2125# ;SPMamp; Thefunction#tex2html_wrap_inline2126#returnstheresultantofthepolynomials#tex2html_wrap_inline2127# ;SPMamp; $ ;SPMlt; poly1 ;SPMgt; $ and$ ;SPMlt; poly2 ;SPMgt; $ withrespecttothevariable$ ;SPMlt; var ;SPMgt; $.#tex2html_wrap_inline2128# ;SPMamp; #tex2html_wrap_inline2129##tex2html_wrap_inline2130#e2 : resultant(x2 + a, x3 + a, x);
23e2 : a + a
#tex2html_wrap_inline2131##tex2html_wrap_inline2132#
#tex2html_wrap_inline2133#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2134# ;SPMamp; #tex2html_wrap_inline2135# ;SPMamp; Thecommand#tex2html_wrap_inline2136#returnsthe$i$throwofthematrix$ ;SPMlt; matrix ;SPMgt; $, where$i= ;SPMlt; int ;SPMgt; $.#tex2html_wrap_inline2137# ;SPMamp; If$ ;SPMlt; int ;SPMgt; $ islargerthanthenumberofrowsof$ ;SPMlt; matrix ;SPMgt; $, thenJacalprints#tex2html_wrap_inline2138# ;SPMamp; anerrormessage.Thecorrespondingcommandforcolumnsofamatrixis#tex2html_wrap_inline2139#.#tex2html_wrap_inline2140# ;SPMamp; #tex2html_wrap_inline2141##tex2html_wrap_inline2142#e3 : u : [[1, 2, 3],[1, 5, 3]];
[123]e3 : [][153]
e4 : row(u, 2);
e4 : [1, 5, 3]
#tex2html_wrap_inline2143##tex2html_wrap_inline2144#
#tex2html_wrap_inline2145#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2146# ;SPMamp; Thecommand#tex2html_wrap_inline2147#takesasinputsapositiveinteger#tex2html_wrap_inline2148# ;SPMamp; $ ;SPMlt; size ;SPMgt; $ andanalgebraicexpression$ ;SPMlt; entry ;SPMgt; $ andreturnsan$n×n$#tex2html_wrap_inline2149# ;SPMamp; diagonalmatrixwhosediagonalentriesareallequalto$ ;SPMlt; entry ;SPMgt; $, where#tex2html_wrap_inline2150# ;SPMamp; $n= ;SPMlt; size ;SPMgt; $.#tex2html_wrap_inline2151##tex2html_wrap_inline2152#
e1 : scalarmatrix(3, 6);
[600][]e1 : [060][][006]
#tex2html_wrap_inline2153##tex2html_wrap_inline2154#
#tex2html_wrap_inline2155#
#tex2html_wrap_inline2156#
#tex2html_wrap_inline2157#
#tex2html_wrap_inline2158#
#tex2html_wrap_inline2159#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2160# ;SPMamp; TherearevariousflagsthattheJacalusercancontrol, namelytheJacal#tex2html_wrap_inline2161# ;SPMamp; commandlineprompt, thepriorityforprintingtermsinJacaloutput, theinput#tex2html_wrap_inline2162# ;SPMamp; grammarandtheoutputgrammar.Foradiscussion#tex2html_wrap_inline2163# ;SPMamp; ofthevariousgrammarspleaseseesection???ofthismanual.Thecommand#tex2html_wrap_inline2164##tex2html_wrap_inline2165# ;SPMamp; iscloselyrelated, allowingonetoseewhatthecurrentsettingsare.#tex2html_wrap_inline2166# ;SPMamp; Ifonechangestheprompt,$ ;SPMlt; string ;SPMgt; $ isastringofalphanumericcharacters#tex2html_wrap_inline2167# ;SPMamp; withoutquotes.Afterthiscommandisexecuted, subsequentcommandswillcuase#tex2html_wrap_inline2168# ;SPMamp; newpromptstobeobtainedfrom$ ;SPMlt; string ;SPMgt; $ byincrementingit.Iftheprompt#tex2html_wrap_inline2169# ;SPMamp; endsinaletter, itwillbetreatedasadigitinbase26andincremented.#tex2html_wrap_inline2170# ;SPMamp; Ifitendsinastringofdigits, thatstringwillbetreatedasanumberinbase#tex2html_wrap_inline2171# ;SPMamp; 10andincremented.#tex2html_wrap_inline2172# ;SPMamp; Theremainingcharactersinthestringwillplaynoroleinthisincrementation.#tex2html_wrap_inline2173# ;SPMamp; #tex2html_wrap_inline2174##tex2html_wrap_inline2175#e1 : setpromptaz9Z;e1 : a + b;
az9Z : a + b
az9AA : a + b;
az9AA : a + b
az9AB : setpromptok99;az9AB : a + b;
ok99 : a + b
ok100 : a + b;
ok100 : a + b
ok101 :
#tex2html_wrap_inline2176##tex2html_wrap_inline2177#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2178# ;SPMamp; Thefollowingexamplesshowhowonechangestheinputgrammarorthe#tex2html_wrap_inline2179# ;SPMamp; outputgrammar.#tex2html_wrap_inline2180# ;SPMamp; #tex2html_wrap_inline2181##tex2html_wrap_inline2182#e1 : a : [[[1, 2, 3]]];
e1 : [[1, 2, 3]]
e2 : setoutgrammarstandard;e2 : a;
e2 : [[[1, 2, 3]]]
e3 : setoutgrammarscheme;e3 : a;
(definee3#(#(#(123))))e4 : (1 + x)5;
(definee4(+ 1(*5x)(*10(x2))(*10(x3))(*5(x4))(x5)))e6 : setingrammarscheme;e6 : (+ e41);
(definee6(+ 2(*5x)(*10(x2))(*10(x3))(*5(x4))(x5)))e7 : (setingrammardisp2d )e7 : diagmatrix(3, 6);
(definee7#(#(30)#(06)))e8 : setoutgrammardisp2d;e8 : e7;
[30]e8 : [][06]
e9 : setoutgrammarstandard;e9 : e7;
e9 : [[3, 0],[0, 6]]
#tex2html_wrap_inline2183##tex2html_wrap_inline2184#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2185# ;SPMamp; Notethatintheaboveexamples, itispossibletoinputandoutputexpressions#tex2html_wrap_inline2186# ;SPMamp; inschemebysettingtheingrammarand /oroutgrammarto#tex2html_wrap_inline2187#.Doingsoresult#tex2html_wrap_inline2188# ;SPMamp; inlinearoutput(aswith#tex2html_wrap_inline2189#)asopposedtoatwodimensional#tex2html_wrap_inline2190# ;SPMamp; display(aswith#tex2html_wrap_inline2191#).Theanalogueof#tex2html_wrap_inline2192#forschemeoutput#tex2html_wrap_inline2193# ;SPMamp; isschemeprettyprinting.Tohavesuchoutput, settheoutputgrammarto#tex2html_wrap_inline2194# ;SPMamp; #tex2html_wrap_inline2195#.#tex2html_wrap_inline2196# ;SPMamp; #tex2html_wrap_inline2197##tex2html_wrap_inline2198#
e4 : setoutgrammarschemepretty;e4 : (1 + x)5;
(definee4(+ 1(*5x)(*10(x2))(*10(x3))(*5(x4))(x5)))
#tex2html_wrap_inline2199##tex2html_wrap_inline2200#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2201# ;SPMamp; JacalalsoallowsforoutputtobeautomaticallytypesetinTEX.Thiscanbe#tex2html_wrap_inline2202# ;SPMamp; quiteusefulifonewantstousetheresultsofone'scomputationsinpublished#tex2html_wrap_inline2203# ;SPMamp; articles.Continuingwiththeexampleof$(1+x)5$ above, wehave.#tex2html_wrap_inline2204# ;SPMamp; #tex2html_wrap_inline2205##tex2html_wrap_inline2206#
e5 : setoutgrammartex;e5 : e4;
e5 : 1 + 5x + 10x2 +10x3 +5x4 + x5
e6 : (1 + 1/x)3/(1 - 1/y)4;
e6 : #tex2html_wrap_inline2207#1 + 3x + 3x2 + x3#tex2html_wrap_inline2208#y4#tex2html_wrap_inline2209#x3-4x3y+
6x3y2-4x3y3+x3y4
#tex2html_wrap_inline2210##tex2html_wrap_inline2211#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2212# ;SPMamp; Afterbeingincludedinadocumentinmathdisplaymode, thesetwoexamples#tex2html_wrap_inline2213# ;SPMamp; willappearinthefollowingway.#tex2html_wrap_inline2214# ;SPMamp; #tex2html_wrap_inline2215##math26#1 + 5x + 10x2 +10x3 +5x4 + x5#math27##tex2html_wrap_inline2219#1 + 3x + 3x2 + x3#tex2html_wrap_inline2220#y4#tex2html_wrap_inline2221#x3-4x3y+6x3y2-4x3y3+x3y4#math28##tex2html_wrap_inline2223#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2224# ;SPMamp; ThatlooksmuchbetterinanarticlethantheactualJacaloutputindisp2d#tex2html_wrap_inline2225# ;SPMamp; grammar.#tex2html_wrap_inline2226# ;SPMamp; #tex2html_wrap_inline2227##tex2html_wrap_inline2228#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2229# ;SPMamp; Thefollowingexamplesshowhowtosetthepriorityofprintingterms.#tex2html_wrap_inline2230##tex2html_wrap_inline2231#e10 : a;
e10 : [[[1, 2, 3]]]
e11 : showprioritya;
;;;notasimplevariable : (((123).()).())
e12 : showpriorityb;
e12 : 128
e13 : showpriorityc;
e13 : 128
e14 : b + c;
e14 : b + c
e15 : c + b;
e15 : b + c
e16 : setpriorityb200;e16 : b + c;
#tex2html_wrap_inline2232##tex2html_wrap_inline2233#
#tex2html_wrap_inline2234#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2235# ;SPMamp; Thecommand#tex2html_wrap_inline2236#enablestheJacalusertoexaminethecurrentsetting#tex2html_wrap_inline2237# ;SPMamp; ofvariousflagsaswellastolisttheflagsthatcanbesetbytheuserand#tex2html_wrap_inline2238# ;SPMamp; todisplayotherinformation.Tochangethesettingsoftheflags, usethecommand#tex2html_wrap_inline2239# ;SPMamp; #tex2html_wrap_inline2240#.Toseealltheinformationaccessiblethroughthe#tex2html_wrap_inline2241#command,#tex2html_wrap_inline2242# ;SPMamp; type#tex2html_wrap_inline2243#.Toseetheavailablegrammars, type#tex2html_wrap_inline2244#.#tex2html_wrap_inline2245# ;SPMamp; Toseethecurrentinputgrammartype#tex2html_wrap_inline2246#.Toseethecurrent#tex2html_wrap_inline2247# ;SPMamp; outputgrammar, type#tex2html_wrap_inline2248#.Toseethecurrentpriorityfor#tex2html_wrap_inline2249# ;SPMamp; printingexpressions, type#tex2html_wrap_inline2250#.#tex2html_wrap_inline2251# ;SPMamp; #tex2html_wrap_inline2252##tex2html_wrap_inline2253#e1 : showall;
promptpriorityoutgrammaringrammargrammarsalle1 : showprompt;
e1 : e1
e3 : showpriority;
: @(differential : @)@3@2@17differentialtermstsystemsylvestershowpriorityshowsetscalarmatrixrowresultantrapplyquitqedpromptprioritypolydiscriminantpolyornumnegatemodminormatrixloadlistofvarsidentgenmatrixgcdfinvfactorexampleeliminatee1dotproductdividediffdiagmatrixdeterminantdescribedenomcrossproductcontentcommandscolcoeffscoeffcbunchbatchb - / + b + / - balla=/ - + *8e3 : showoutgrammar;
e3 : disp2d
e4 : showingrammar;
e4 : standard
e5 : showgrammars;
e5 : [disp2d, standard, schemepretty, scheme]
#tex2html_wrap_inline2254##tex2html_wrap_inline2255#
#tex2html_wrap_inline2256#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2257# ;SPMamp; #tex2html_wrap_inline2258# ;SPMamp; Here,$ ;SPMlt; poly1 ;SPMgt; $ and$ ;SPMlt; poly2 ;SPMgt; $ arepolynomialsand$ ;SPMlt; var ;SPMgt; $ isavariable.#tex2html_wrap_inline2259# ;SPMamp; Thefunction#tex2html_wrap_inline2260#returnsthematrixintroducedbySylvester(``A#tex2html_wrap_inline2261# ;SPMamp; MethodofDeterminingByMereInspectiontheDerivativesfromTwoEquations#tex2html_wrap_inline2262# ;SPMamp; ofAnyDegree,''Phil.Mag.#tex2html_wrap_inline2263#(1840)pp.132-135, MathematicalPapers,#tex2html_wrap_inline2264# ;SPMamp; vol.I, pp.54-57)forcomputingtheresultantofthetwopolynomials#tex2html_wrap_inline2265# ;SPMamp; $ ;SPMlt; poly1 ;SPMgt; $ and$ ;SPMlt; poly2 ;SPMgt; $ withrespecttothevariable$ ;SPMlt; var ;SPMgt; $.Ifonewants#tex2html_wrap_inline2266# ;SPMamp; tocomputetheresultantitself, onecansimplyusethecommand#tex2html_wrap_inline2267##tex2html_wrap_inline2268# ;SPMamp; withthesamesyntax.#tex2html_wrap_inline2269# ;SPMamp; #tex2html_wrap_inline2270##tex2html_wrap_inline2271#e5 : sylvester(a0 + a1*x + a2*x2 + a3*x3, b0 + b1*x + b2*x2, x);
[a3a2a1a00][][0a3a2a1a0][]e5 : [b2b1b000][][0b2b1b00][][00b2b1b0]
#tex2html_wrap_inline2272##tex2html_wrap_inline2273#
#tex2html_wrap_inline2274#;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein# ;SPMamp; ;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;##tex2html_wrap_inline2275# ;SPMamp; #tex2html_wrap_inline2276# ;SPMamp; OnecanissuecommandstotheoperatingsystemwithoutleavingJacal.Todothis,#tex2html_wrap_inline2277# ;SPMamp; oneusesthecommand#tex2html_wrap_inline2278#.Forexample, inaUNIXoperatingsystem, the#tex2html_wrap_inline2279# ;SPMamp; command#tex2html_wrap_inline2280#willprintthedirectory.Onewayinwhichthe#tex2html_wrap_inline2281# ;SPMamp; command#tex2html_wrap_inline2282#mightbeespeciallyusefulistoeditfilescontaining#tex2html_wrap_inline2283# ;SPMamp; JacalscriptswithoutleavingJacal, particularlyinnon-UNIXmachinesoron#tex2html_wrap_inline2284# ;SPMamp; machineswithoutGNUemacs.#tex2html_wrap_inline2285# ;SPMamp; #tex2html_wrap_inline2286##tex2html_wrap_inline2287#e6 : system(;SPMquot;mailirmentrude;SPMquot;);
HiIrma, howareyou?
Lancelot.
e6 : 0
e7 : system(;SPMquot;exgleep;SPMquot;);;SPMquot;gleep;SPMquot;26lines, 239characters : a. : 1,
COPYING
ChangeLog
MANUAL
Makefile
OLD
README
TAGS
builtin.scm
code.doc
compilem.lisp
ext.scm
func.scm
hist.scm
math.lisp
math.scm
norm.scm
parse.scm
poly.scm
scl.lisp
scl.scm
sexp.scm
stdgrm.scm
toploads.scm
types.scm
unparse.scm
vect.scm
:a
test.scm
.
:wq
;SPMquot;gleep;SPMquot; 28 lines, 249 characters
e7: 0
<#215#>terms()<#215#>
<#216#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;Prints a copy of the GNU General Public License
;SPMamp;<#216#>
e6 : terms();
e6 : terms();
GNU GENERAL PUBLIC LICENSE
**************************
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
========
The license agreements of most software companies try to keep users
at the mercy of those companies. By contrast, our General Public
License is intended to guarantee your freedom to share and change free
software---to make sure the software is free for all its users. The
General Public License applies to the Free Software Foundation's
software and to any other program whose authors commit to using it.
You can use it for your programs, too.
[ rest deleted for brevity]
<#217#>differential(;SPMlt; expr ;SPMgt;)<#217#>
;SPMlt; expr ;SPMgt; '
<#282#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;The Jacal command <#218#>differential<#218#> computes the derivative of the expression
;SPMamp;;SPMlt; expr ;SPMgt; with respect to a generic derivation. It is generic in the sense that
;SPMamp;nothing is assumed about its effect on the individual variables. The derivation
;SPMamp;is denoted by a right quote.
;SPMamp;<#282#>
e6 : differential(x^2+y^3);
2
e6: 2 x x' + 3 y y'
e7 : (x^2+y^3)';
2
e7: 2 x x' + 3 y y'
<#219#>transcript(;SPMlt; string ;SPMgt;)<#219#>
<#283#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;
;SPMamp;The command <#220#>transcript<#220#> allows one to record a Jacal session. It is called
;SPMamp;with the syntax <#221#>transcript(;SPMlt; string ;SPMgt;);<#221#>, where ;SPMlt; string ;SPMgt; is the name of
;SPMamp;the file in which one wants to keep the transcript of the session. When one wishes
;SPMamp;to stop recording, one types <#222#>transcript();<#222#>. One is then free to use <#223#>transcript<#223#>
;SPMamp;again later in the session on another file. One can use it on the same file, but the
;SPMamp;file is overwritten. Presently, the command <#224#>transcript<#224#> does not echo commands
;SPMamp;to a file. file.
;SPMamp;<#283#>
e9 : a:[1,2,3];
e9: [1, 2, 3]
e10 : transcript(;SPMquot;foo;SPMquot;);
e10: foo
e11 : a;
e11: [1, 2, 3]
e12 : transcript();
e12 : system(;SPMquot;cat foo;SPMquot;);
e10: foo
e11 : a;
e11: [1, 2, 3]
e12 : transcript();
e12: 0
<#225#>transpose(;SPMlt; matrix ;SPMgt;)<#225#>
<#284#>;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;truein#;SPMamp;;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;#
;SPMamp;
;SPMamp;The command <#226#>transpose<#226#> takes a matrix as argument and returns the transpose
;SPMamp;of the matrix.
;SPMamp;
<#284#>
e13 : q:[[1,1,1,1,1],[1,2,3,4,5]];
[1 1 1 1 1]
e13: [ ]
[1 2 3 4 5]
e14 : transpose(e13);
[1 1]
[ ]
[1 2]
[ ]
e14: [1 3]
[ ]
[1 4]
[ ]
[1 5]