e1 : set prompt az9Z; e1 : a+b; az9Z: a + b az9AA : a+b; az9AA: a + b az9AB : set prompt ok99; az9AB : a+b; ok99: a + b ok100 : a+b; ok100: a + b ok101 :
e1 : a:[[[1,2,3]]]; e1: [[1, 2, 3]] e2 : set outgrammar standard; e2 : a; e2: [[[1, 2, 3]]] e3 : set outgrammar scheme; e3 : a; (define e3 #(#(#(1 2 3)))) e4 : (1+x)^5; (define e4 (+ 1 (* 5 x) (* 10 (^ x 2)) (* 10 (^ x 3)) (* 5 (^ x 4)) (^ x 5))) e6 : set ingrammar scheme; e6 : (+ e4 1); (define e6 (+ 2 (* 5 x) (* 10 (^ x 2)) (* 10 (^ x 3)) (* 5 (^ x 4)) (^ x 5))) e7 : (set ingrammar disp2d) e7 : diagmatrix(3,6); (define e7 #(#(3 0) #(0 6))) e8 : set outgrammar disp2d; e8 : e7; [3 0] e8: [ ] [0 6] e9 : set outgrammar standard; e9 : e7; e9: [[3, 0], [0, 6]]
Note that in the above examples, it is possible to input and output
expressions in scheme by setting the ingrammar and/or outgrammar to
scheme
. Doing so result in linear output (as with standard
grammar
) as opposed to a two dimensional display (as with
disp2d
). The analogue of disp2d
for scheme output is
scheme pretty-printing. To have such output, set the output grammar to
schemepretty
.
e4 : set outgrammar schemepretty; e4 : (1+x)^5; (define e4 (+ 1 (* 5 x) (* 10 (^ x 2)) (* 10 (^ x 3)) (* 5 (^ x 4)) (^ x 5)))
Jacal also allows for output to be automatically typeset in TeX.
This can be quite useful if one wants to use the results of one's
computations in published articles. Continuing with the example of
(1+x)^5
above, we have:
e5 : set outgrammar tex; e5 : e4; e5: 1 + 5 x + 10 x^{2} + 10 x^{3} + 5 x^{4} + x^{5} e6 : (1+1/x)^3/(1-1/y)^4; e6: {\left(1 + 3 x + 3 x^{2} + x^{3}\right) y^{4}}\over{x^{3} - 4 x^{3} y + 6 x^{3} y^{2} - 4 x^{3} y^{3} + x^{3} y^{4}}
e10 : a; e10: [[[1, 2, 3]]] e11 : show priority a; ;;; not a simple variable: (((1 2 3) . ()) . ()) e12 : show priority b; e12: 128 e13 : show priority c; e13: 128 e14 : b+c; e14: b + c e15 : c+b; e15: b + c e16 : set priority b 200; e16 : b+c;
Go to the first, previous, next, last section, table of contents.