| www.delorie.com/gnu/docs/maxima/maxima_33.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Because of this we make the system variables and functions all upper case, and users may enter them however they like (in upper or lower). But all other variables and functions are case sensitive. When you print out your program using for example grind(fundef(f)) then you will see that the symbols like 'IF', 'SIN',... all appear in upper case whereas non system symbols appear in the case which you used.
This is implemented as follows: If the symbol is being encountered for the first time, if the upper case version is in the package and has a nontrivial function or property list, then the upper case symbol is used, and it is recorded on the mixed case one, that the upper case should be used in future. If a symbol is already in the package then it is just used.
In effect this means that most old programs should continue to work, and that new ones may write sIn, Sin, SIN, sin etc and they will all be interpreted as SIN. However if they write MySin this will be different from MYSIN, because MYSIN is not a system function or variable.
SeriesSolve(f,x):= if (f = sin) ... and this is read as SeriesSolve(f,x):= IF (f = SIN) ... |
evaluates its arguments and concatenates them into a string. Unlike CONCAT, the arguments do NOT need to be atoms. The result is a Common Lisp String.
(C5) sconcat("xx[",3,"]:",expand((x+y)^3));
(D5) xx[3]:Y^3+3*X*Y^2+3*X^2*Y+X^3
|
(C1) DISPLAY(B[1,2]);
2
B = X - X
1, 2
(D1) DONE
|
User PART INPART
a-b; A - B A + (- 1) B
A - 1
a/b; - A B
B
1/2
sqrt(x); SQRT(X) X
4 X 4
X*4/3; --- - X
3 3
|
(C1) ERROR("The function", FOO,"doesn't like", U,"as input.");
prints as:
The function FOO doesn't like ERREXP1 as input.
If ERROR_SIZE>24 then as:
E
D
C + B + A
The function FOO doesn't like -------------- as input.
COS(X - 1) + 1
|
Expressions larger than ERROR_SIZE are replaced by symbols, and the symbols are set to the expressions. The symbols are taken from the user-settable list
ERROR_SYMS:[ERREXP1,ERREXP2,ERREXP3] |
"/home/wfs/###.{o,lisp,mac,mc}"
"/home/{wfs,joe}/###.{o,lisp,mac,mc}"
|
(C4) load("eigen");
MACSYMA BUG: Unknown file type NIL
Error: macsyma error
Error signalled by MEVAL1.
Broken at $LOAD. Type :H for Help.
MAXIMA>>:q
By examining the file system we find the file is actually in
/public/maxima/share/eigen.mc. So we add that to the file_search
path. This can be done at start up (see init.lsp) or,
else it can be done and then the system resaved
once it has been customized for local directories and pathnames.
At lisp level we would do
(in-package "MAXIMA")
(setq $file_search ($append (list '(mlist)
"/tmp/foo.mac" "/tmp/foo.mc") $file_search))
and at maxima level:
(C5) file_search:append(["/public/maxima/share/foo.mc"],
file_search)$
(C6) load("eigen");
batching /usr/public/maxima/share/eigen.mc
(D6) #/public/maxima/share/eigen.mc
(C7) eigenvalues(matrix([a,b],[c,d]));
2 2
- SQRT(D - 2 A D + 4 B C + A ) + D + A
(D7) [[---------------------------------------,
2
2 2
SQRT(D - 2 A D + 4 B C + A ) + D + A
-------------------------------------], [1, 1]]
2
|
TCL_OUTPUT([x1,y1,x2,y2,x3,y3],1) --> {x1 x2 x3 }
TCL_OUTPUT([x1,y1,x2,y2,x3,y3],2) --> {y1 y2 y3 }
TCL_OUTPUT([1,2,3,4,5,6],1,3) --> {1 4}
TCL_OUTPUT([1,2,3,4,5,6],2,3) --> {2 5}
|
(C1) INTEGRATE(1/(X^3+2),X)$
(C2) REVEAL(%,2);
(D2) Negterm + Quotient + Quotient
(C3) REVEAL(D1,3);
ATAN LOG
(D3) - Quotient + ---------- + ----------
Product(2) Product(2)
|
In the case of a label, a left-equation-number will be produced. in case a file-name is supplied, the output will be appended to the file.
(C1) integrate(1/(1+x^3),x);
2 x - 1
2 ATAN(-------)
LOG(x - x + 1) SQRT(3) LOG(x + 1)
(D1) - --------------- + ------------- + ----------
6 SQRT(3) 3
(C2) tex(d1);
$$-{{\log \left(x^{2}-x+1\right)}\over{6}}+{{\arctan {{2\>x-1}\over{
\sqrt{3}}}}\over{\sqrt{3}}}+{{\log \left(x+1\right)}\over{3}}\leqno{\tt (D1)}$$
(D2) (D1)
(C6) tex(integrate(sin(x),x));
$$-\cos x$$
(D6) FALSE
(C7) tex(d1,"/tmp/jo.tex");
(D7) (D1)
|
(C1) (with_stdout("_hist.out",
for i:1 thru length(hist) do (
print(i,hist[i]))),
system("xgraph -bar -brw .7 -nl < _hist.out"));
|
system("(xgraph -bar -brw .7 -nl < _hist.out; rm -f _hist.out)&")
|
mygnuplot(f,var,range,number_ticks):=
block([numer:true,display2d:false],
with_stdout("/tmp/gnu",
for x:range[1] thru range[2] step
(range[2]-range[1])/number_ticks
do (print(x,at(f,var=x)))),
system("echo \"set data style lines; set title '",
f,"' ;plot '/tmp/gnu'
;pause 10 \" | gnuplot"));
(C8) with_stdout("/home/wfs/joe",
n:10,
for i:8 thru n
do(print("factorial(",i,") gives ",i!)));
(D8) FALSE
(C9) system("cat /home/wfs/joe");
factorial( 8 ) gives 40320
factorial( 9 ) gives 362880
factorial( 10 ) gives 3628800
(D9) 0
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |