JACAL MANUAL December 13, 1989
Aubrey Jaffer
Bertronics
84 Pleasant St.
Wakefield MA, 01880
617-245-0545
INTRODUCTION
JACAL System is a computer program for the manipulation and simplification of
algebraic and complex analytic equations, expressions, functions, and constants.
OVERVIEW OF THE JACAL SYSTEM
JACAL differs from many other symbolic mathematics systems in that the input and
outupt formats are the same. Any expression typed out by JACAL can be used as
input. If the user has an input editor, she can extract parts of expressions
easily with it.
The syntax used by JACAL is a slightly extended version of MACSYMA syntax. The
extensions are the use of x' to represent differentials and the construct
{x|equation}. This represents a (possibly multiple) value of the roots of
equation in x. | is read as "such that".
STARTING JACAL
To load JACAL from unix,
% cd jacal
% lisp
> (load "math")
system dependent messages
...
type (math) to begin
> (math)
type QED to return to lisp
E1 :
ENTERING EXPRESSIONS
An expression now typed (for instance a-b;) will be assigned to E1. An
expression can be terminated with ";" or "$". If the end is:
";" print normalized expression
"$" print nothing
As soon as the expression is parsed the label is printed again
E1
As soon as the expression is succesfully evaluated and normalized a
colon is printed
E1 :
Then the expression is factored (if desired) and printed.
E1 : A - B
Whenever E1 is appears in an expression from now on it is immediately
replaced by its value.
E2 : 4-e1 /*comments can appear anywhere a space can appear*/;
E2 : 4 - A + B
DEFINING SYMBOLS
Other symbols can be defined by ":" or ":="
E3 : disc: b^2-4*a*c;
E3 : B^2 - 4*A*C
E4 : x := (-b +/-disc^(1/2))/(2*a);
E4 : (- B +/- (B^2 - 4*A*C)^(1/2)) / (2*A)
We could also have defined both at once:
E5 : x := (-b +/-(disc: b^2-4*a*c)^(1/2))/(2*a);
E5 : (- B +/- (B^2 - 4*A*C)^(1/2)) / (2*A)
X is now defined the same as E4 (and DISC as E3). A symbol can be
redefined, but not using the previous value of that symbol. Therefore,
to reset a symbol simply define it to itself.
E6 : x := x;
E6 : X
DEFINING FUNCTIONS
E7 : f(x,y) := x^2+y^2;
E7 : \@1,@2; @1^2 + @2^2
E8 : f(8,x);
E8 : 64 + x^2;
We could have equivalently typed
E9 : f : \x,y;x^2+y^2;
E9 : \@1,@2; @1^2 + @2^2
with the same effect. Functions can be added, subtracted, ... like
other expressions.
E10 : f*f+b+3;
E10 : \@1,@2; 3 + B + @1^4 + 2*@1^2*@2^2 + @2^4
@1 and @2 are arguments while B and 3 are not.
OPERATORS
Consider the differential operator (a flag can be set to have output
use %d instead of ')
E11 : y*%d/%d(x)-x*%d/%d(y);
E11 : \@1; Y*@1'/X' - X*@1'/Y'
E12 : e11(x^3+y^2);
E12 : (3*X^2 - 2*X)*Y
EQUATIONS
E7 : c=-a*x^2-b*x;
E7 : C + B*X + A*X^2=0
E7 is the only symbol defined here. It's value is the entire equation.
An equation can be viewed as a constraint on variables or as
describing a surface in the space of the variables. An equation has no
effect unless it is explicitly an argument.
E8 : eliminate([e7, b^2=2*(c^2+a^2)],b);
E8 :
Vectors and Matrices can be represented using a BUNCHes:
E11 : [[a, b, c], [d, e, f], [g, h, i]];
E11 : [[A, B, C]
,[D, E, F]
,[G, H, I]]
E12 : transpose(e11);
E12 : [[A, D, G]
,[B, E, H]
,[C, F, I]]
E13 : determinant(%);
E13 : (- C*E + B*F)*G + (C*D - A*F)*H + (- B*D + A*E)*I
E49 : e11[1,2];
E49 : B
E50 : e11[1];
E50 : [A, B, C]
Sytems of equations can be represented in the same form.
E63 : sqrtx: {y|y^2=x}; /*this defines the symbol sqrtx to be a square
root of x*/
E63 : {@ | @^2 = X}
E67 : sqrtx-sqrtx;
E67 : 0
E68 : {y|y^2=x}-{y|y^2=x}; /* +/-sqrtx - +/-sqrtx */
E68 : {@ | @^2 = 4*X} OR 0 /*there are 3 possible answers*/
E64 : diff(sqrtx,x); /*this takes derivative of a square root of x */
E64 : X' / (2*SQRTX) /*result must be related to SQRTX */
E65 : diff({y|y^2=x},x); /*derivative of +/-sqrtx */
E65 : {@ | @^2 = X'^2 / (4*X)}
E3 : sqrt(x) := x^(1/2);
E3 : \@1; {@ | @^2 = @1}
E4 : sqrt(y);
E4 : {@ | @^2 = Y}
E1 : plus + times;
E1 : \@1,@2; @1 + (1 + @1)*@2
E7 : E1(4,t);
E7 : 4 + 5*T
Even Currying of arguments is supported:
E8 : E1(q);
E8 : \@2; Q + (1 + Q)*@2
E9 : E8(u);
E9 : Q + (1 + Q)*U
E22 : {Y | Y^2 = X^2}
should reduce to:
E22 : {@ | @^2 = 1}*X;
Scheme translation
a+b*c;
(+ a (* b c))
\a,b;a+b;
(lambda (a b) (+ a b))
a : b=c;
(set! a (= b c))
a := g-i;
(set! a (- g i))
if a=?b then c=a else c=b; the else c=b is optional
(if (=? a b) (= c a) (= c b))