solve(x^2=1,x);
solve([2*x+3*y=1,3*x+2*y=1],[x,y]);
allroots(x^8+x+1=0);
f(x,y):=x^2+y^2
define(f(x),diff(sin(x),x))
define(f(x,y),x^2+y^2);
diff(f(x,y),x);
x:1;
x:%i;
f(x)等がf(1)あるいはf(%i)として処理される。
array(x,5);
x[0]:1; x[1]:2; x[2]:3; x[3]:4; x[4]:5; x[5]:6;
array(x,5);とすれば配列xを長さ$6$の配列として定
義する。x[0]は第0番目の配列要素とよぶ。
配列要素は0番目から始まることに注意する。上の例では各配列要素に
数値を代入している。
array(x,5);
for n:0 thru 5 do x[n]:n^2;
配列に $n^2$を代入している。変数nを0から5まで順に変化さ
せながらdo以下の処理を実行する。
if x=0 then y:2;
if x=0 then y:2 else y:3;
if x=0 then y:2 elseif x=1 then y:3;
f(x):=block(if x<0 then 0 else exp(-1/x))$
x[0]:1;
y[0]:1;
for n:1 thru 5 do
block(
x[n]:x[n-1]+n,
y[n]:2*y[n-1]
)$
f(x):=1+x/2;
array(a,5);
a[0]:1;
for n:1 thru 5 do a[n]:f(a[n-1]);
listarray(a);
array(y,100);
for n:0 thru 100 do y[n]:n^2;
plot2d([discrete, listarray(y)],[x,0,100])
g(x):=diff(x^2,x)$
diff(g(x),x);
Maxima からこのファイルの内容を実行する際は次のようにする。
batch("filename");
ファイル名の指定には、フォルダを含めて指定する必要があるかもしれな
い。それぞれの環境による。
contour_plot(f(x,y),[x,-2,2],[y,-2,2], [gnuplot_preamble, "set cntrparam levels 12"]);
関数値を色分けしてプロットする。
contour_plot(f(x,y),[x,-2,2],[y,-2,2], [gnuplot_preamble,"set cntrparam levels 12; set pm3d"]);