58 lines
1.1 KiB
Text
58 lines
1.1 KiB
Text
|
/* Maxima computer algebra system */
|
||
|
|
||
|
/* symbolic constants */
|
||
|
|
||
|
[true, false, unknown, inf, minf, ind,
|
||
|
und, %e, %i, %pi, %phi, %gamma];
|
||
|
|
||
|
/* programming keywords */
|
||
|
|
||
|
if a then b elseif c then d else f;
|
||
|
for x:1 thru 10 step 2 do print(x);
|
||
|
for z:-2 while z < 0 do print(z);
|
||
|
for m:0 unless m > 10 do print(m);
|
||
|
for x in [1, 2, 3] do print(x);
|
||
|
foo and bar or not baz;
|
||
|
|
||
|
/* built-in variables */
|
||
|
|
||
|
[_, __, %, %%, linel, simp, dispflag,
|
||
|
stringdisp, lispdisp, %edispflag];
|
||
|
|
||
|
/* built-in functions */
|
||
|
|
||
|
[sin, cosh, exp, atan2, sqrt, log, struve_h,
|
||
|
sublist_indices, read_array];
|
||
|
|
||
|
/* user-defined symbols */
|
||
|
|
||
|
[foo, ?bar, baz%, quux_mumble_blurf];
|
||
|
|
||
|
/* symbols using Unicode characters */
|
||
|
|
||
|
[Љ, Щ, щ, Ӄ, ЩЩЩ, ӃӃЉЉщ];
|
||
|
|
||
|
/* numbers */
|
||
|
|
||
|
ibase : 18 $
|
||
|
[0, 1234, 1234., 0abcdefgh];
|
||
|
reset (ibase) $
|
||
|
[.54321, 3.21e+0, 12.34B56];
|
||
|
|
||
|
/* strings */
|
||
|
|
||
|
s1 : "\"now\" is";
|
||
|
s2 : "the 'time' for all good men";
|
||
|
print (s1, s2, "to come to the aid",
|
||
|
"of their country");
|
||
|
|
||
|
/* expressions */
|
||
|
|
||
|
foo (x, y, z) :=
|
||
|
if x > 1 + y
|
||
|
then z - x*y
|
||
|
elseif y <= 100!
|
||
|
then x/(y + z)^2
|
||
|
else z - y . x . y;
|
||
|
|