7 Miscellaneous

Command: %

The symbol % represents the last expression obtained by Jacal. It can be used in formulas like any other constant or variable or expression.

(%0010) 5+x;
%0010: 5 + x
(%0011) %^2-%;
                   2
%0011: 20 + 9 x + x
Command: batch filename

The command batch is used to read in a file containing programs written in Jacal. Here, filename is a string in double quotes. The precise way in which one refers to a file is, of course, system dependent.

batch("demo");

of the file demo in the JACAL directory will give a demonstration of JACAL’s capabilities.

Command: tex expr
Command: scheme expr
Command: disp2d expr
Command: standard expr
Command: std expr

Displays expr in TeX, the Scheme programming language, Jacal’s two-dimensional output format, Jacal’s infix input format, or compressed infix format respectively.

If one these top-level function calls is prefixed with %horner, the output will be in Horner’s rule format, multiplication instead of exponentiation.

(%0002) disp2d((x-1)^3/(x+1)^3);
              2    3
-1 + 3 x - 3 x  + x
--------------------
             2    3
1 + 3 x + 3 x  + x
(%0002) horner(disp2d((x-1)^3/(x+1)^3));
-1 + (3 + (-3 + x) x) x
-----------------------
 1 + (3 + (3 + x) x) x
(%0002) scheme((x-1)^3/(x+1)^3);
(/ (+ (- (+ -1 (* 3 x)) (* 3 (expt x 2)))
      (expt x 3))
   (+ 1 (* 3 x) (* 3 (expt x 2)) (expt x 3)))
(%0002) standard((x-1)^3/(x+1)^3);
(-1 + 3 * x - 3 * x^2 + x^3)/(1 + 3 * x + 3 * x^2 + x^3)
(%0002) std((x-1)^3/(x+1)^3);
(-1+3*x-3*x^2+x^3)/(1+3*x+3*x^2+x^3)
(%0002) tex((x-1)^3/(x+1)^3);
{{-1+3\,x-3\,x^{2}+x^{3}}\over{1+3\,x+3\,x^{2}+x^{3}}}
Command: tex "string"

Read TeX expression string. The tex command reads its double-quoted argument as a TeX expression

Command: scheme "string"

Read Scheme double-quoted string argument as Scheme cdoe.

(%0000) scheme("(- (expt b 2) (* 4 a c))");
        2
%0000: b  - 4 a c
Command: disp2d "string"
Command: standard "string"
Command: std "string"

Reads double-quoted string in Jacal’s infix input format.

Command: commands

The command commands produces a list of all of the command available in Jacal. It is called as a function of no arguments.

commands();
% * + - / = ^ ^^ abs args augcoefmatrix b+/- b-/+ batch berl bunch cabs
cartprod chain chainables charpoly coeff coeffs coefmatrix cofactor col
commands compose content continue crossproduct decompose degree denom
depends derivative describe determinant diagmatrix diff differential
discriminant disp2d divide dotproduct elementwise eliminate equatecoeffs
example extrule factorial factors ffsff finv flatten func gcd genmatrix
help ident imagpart integrate interp interp.lagrange interp.neville
interp.newton jacobi jacobian listofvars load matrix minor mod monomial
ncmult negate normalize num or over parallel parfrac partial poly
polyelim prime? qed quit rank realpart require restart resultant row rref
scalarmatrix scheme set sff shadow show standard std sylvester system
taylor terms tex transcript transpose u+/- u-/+ usff varpri vd verify
wronski wronskian
Command: describe command

The command describe is the heart of the builtin help facility of Jacal. Here, command is a string which is the name of a command and describe produces a brief description of the command and in many cases includes an example of its use. Together with the command commands(), which prints a list of all available Jacal commands, and the command example, which gives an example of the use of the command, one can in principle use Jacal without a manual after one has learned how to get started.

(%0012) describe(col);
built-in-operation
column.  column of a matrix
(%0012) describe(resultant);
built-in-operation
resultant.  The result of eliminating a variable between 2
equations (or polynomials).
(%0012) describe(/);
built-in-operation
Quotient, division, divide, over.
a/b
Command: example command

Here, command is a string which is the name of a Jacal command. example gives an example of the use of the command. See also describe.

(%0013) example(*);
a * 7
%0013: 7 a
Command: load string

The Jacal command load takes as input a string and reads in a ‘Scheme’ file whose name is obtained by appending the extension .scm to the string. If you want to read in a file of Jacal commands, do not use load. Instead use the command batch. To load in the file tensor.scm,

(%0014) load("tensor.scm"); 
"tensor.scm"
Command: qed

Exit from Jacal to Scheme. With interactive Scheme systems (such as SCM), It does not return you to the operating system. Instead it suspends Jacal and returns you to the underlying scheme. You can return to the Jacal session where you left off by simply typing (math). If you do not wish to return to Jacal but really want to terminate the session and return to the operating system, then after typing qed();, type (slib:exit) or use quit.

Command: quit

Exit directly from Jacal to the operating system. You will not be able to continue your Jacal session.

(%0015) qed();
scheme
> (math)
Type qed; to return to Scheme, type help; for help.
(%0015) quit();
unix>
Command: system command

One can issue commands to the operating system without leaving Jacal. To do this, one uses the command system. For example, in a UNIX operating system, the command system("ls"); will print the directory. One way in which the command system might be especially useful is to edit files containing Jacal scripts without leaving Jacal, particularly in non-UNIX machines or on machines without GNU emacs.

(%0000) system("echo hi there");
hi there
%0000: 0
Command: terms

Prints a copy of the GNU General Public License

(%0001) terms();
                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

[ rest deleted for brevity]

Command: transcript string

The command transcript allows one to record a Jacal session. It is called with the syntax transcript(string);, where string is the name of the file in which one wants to keep the transcript of the session. When one wishes to stop recording, one types transcript();. One is then free to use transcript again later in the session on another file. One can use it on the same file, but the file is overwritten. Presently, the command transcript does not echo commands to a file.

(%0001) a:[1,2,3];
a: [1, 2, 3]
(%0001) transcript("foo");
"foo"
(%0002) a;
a: [1, 2, 3]
(%0002) transcript();
(%0002) system("cat foo");


(%0002) a;

(%0002) transcript();%0002: 0
Command: set flag value

There are various flags that the Jacal user can control, namely the Jacal command line prompt, the priority for printing terms in Jacal output, the input grammar and the output grammar. For a discussion of the various grammars please See Flags. The command show is closely related, allowing one to see what the current settings are.

Command: show flag

The command show enables the Jacal user to examine the current setting of various flags as well as to list the flags that can be set by the user and to display other information. To change the settings of the flags, use the command set. To see all the information accessible through the show command, type show all. To see the available grammars, type show grammars. To see the current input grammar type show ingrammar. To see the current output grammar, type show outgrammar. To see the current variable ordering, type show ordering.

(%0003) show all;

     all debug echogrammar elims grammars horner ingrammar linkradicals
     ordering outgrammar page phases priority prompt trace version width

(%0003) show prompt;
%0003: %0003

(%0000) show ordering;

     @ @' (tanh(@1))^(1/2) (tanh(@1))' (tan(@1))' (log(@1))'
     (exp(@2*log(@1)))' (exp(@1^2))' (exp(@1))' (exp(1))' (exp(-@2^2))'
     (exp(-@1^2))' (erf(@1))' (erf(%i*@1))' (atanh(1/@1))'
     (atan(@1/(%i*(-1+@1^2)^(1/2))))' (atan(1/@1))' (atan(1/(-1+@1^2)^(1/2)))'
     (atan(1))' (atan((-1+@1^2)^(1/2)))' (atan(%i*(-1+@1^2)^(1/2)/@1))'
     (@1^(1/3))' (@1^(1/2))' (1+(tan(@1))^2)^(1/2) (-1+(tanh(@1))^2)^(1/2)
     ((tanh(@1))^(1/2))' ((atan(1))^(1/2))' ((1+(tan(@1))^2)^(1/2))'
     ((-1+@1^2)^(1/2))' ((-1+(tanh(@1))^2)^(1/2))' %i' y x tanh(@1) tan(@1) t
     ordering log(@1) exp(@2*log(@1)) exp(@1^2) exp(@1) exp(1) exp(-@2^2)
     exp(-@1^2) erf(@1) erf(%i*@1) c b atanh(1/@1)
     atan(@1/(%i*(-1+@1^2)^(1/2))) atan(1/@1) atan(1/(-1+@1^2)^(1/2)) atan(1)
     atan((-1+@1^2)^(1/2)) atan(%i*(-1+@1^2)^(1/2)/@1) a ? ::@ %tanhQ[@1]
     %tanhQ[-1+@1] %tanhQ %tanhP[@1] %tanhP[-1+@1] %tanhPQ %tanhP %tanQ[@1]
     %tanQ[-1+@1] %tanQ %tanP[@1] %tanP[-1+@1] %tanPQ %tanP %expPQ[-1+@1]
     %expPQ %W "Currently in math mode." @3 @2' @2: @2 @1^(1/3) @1^(1/2) @1'
     (-1+@1^2)^(1/2) @1: @1 tanh tan log fre exp erf atanh atan %w
     (atan(1))^(1/2) %sqrt1 %i
(%0000) show outgrammar;
%0000: disp2d
(%0001) show ingrammar;
%0001: standard
(%0002) show grammars;
%0002: [null, raw, scheme, scheme2d, std, standard, disp2d, tex]