l: makelist(x[i], i, 1, 10);

l: map(lambda([t], t^3), l);

p: substpart("+", l, 0);

part(x[1]^3, 1);

part(x[1]^3, 1, 1);

q: map(lambda([t], t^part(t, 1, 1)), p);

map(lambda([t], if part(t, 2)>10 then t else 0), q);

fib(n) := block(  
    if n = 0 then
        return(0)
    else if n = 1 then
        return(1)
    else
        return(fib(n-1) + fib(n-2)));

for n: 1 thru 10 do
    print(fib(n))$

fib(30);

newfib[n] := block(  
    if n = 0 then
        return(0)
    else if n = 1 then
        return(1)
    else
        return(newfib[n-1] + newfib[n-2]));

newfib[30];

newfib[100];

functions;

arrays;

fundef(newfib);
arrayinfo(newfib);
listarray(newfib);

newfib[101];
listarray(newfib);

newfib[100]: 1;
newfib[102];
listarray(newfib);

kill(newfib[100]);
kill(newfib[102]);
newfib[102];
listarray(newfib);

integrate(exp(a*t), t, 0, inf);

assume(a>0);
integrate(exp(a*t), t, 0, inf);

assume(a<0);

kill(a);
assume(a<0);

forget(a>0);
assume(a<0);

integrate(exp(a*t), t, 0, inf);

assume(a<-2);

facts(a);

min(a, 2, cos(b));

kill(all);
facts(a);

diff(cos(x)+y, x);

declare(x, constant);

constantp(cos(x));
constantp(cos(x)+y);

is(a+b=b+a);

is(cos(a+b) = cos(a)*cos(b)-sin(a)*sin(b));

tellsimp(cos(a+b), cos(a)*cos(b)-sin(a)*sin(b));

is(cos(a+b) = cos(a)*cos(b)-sin(a)*sin(b));

cos(a+b);

tellsimp(x^2 + y^2, 1);

x^2 + y^2;

x^3 + y^3;

expression: exp(x)*exp(y) + sin(x+y);

expand(expression);

expand(expression^2);

trigexpand(expression);

trigreduce(%);

expr1: (cos(x))^3*(sin(3*x))^2;

expr2: trigexpand(expr1);

expr3: trigreduce(expr1);

expr4: trigexpand(expr3);

is(expr1 = expr4);

expr1test: float(subst(random(10000), x, expr1));
expr4test: float(subst(random(10000), x, expr4));
expr4test - expr1test;

simplexpr: 1 + sin(x)^2 + cos(x)^2;

trigreduce(simplexpr);

trigsimp(simplexpr);

log(x^y);

log(x*y);

assume(x>0);
assume(y>0);
log(x*y);

logexpand: all;
e1: log(x*y);

kill(all);
sqrt(x^2);

assume(x>0);
sqrt(x^2);

radexpand: all;
sqrt(y^2);

exponentialize(cos(x)*sin(y));

demoivre(%);

solve(2*x^2-3*x+1);

load(solve_rec);

solve_rec(f(n+1) = f(n) + f(n-1), f(n), f(0)=0, f(1)=1);

equ: a^2*(x^2 + x + 1) - a*(2*x - 3) - x^2 -3*x+2;

solve(equ);

solve(equ, x);

equ1: subst(1, a, equ);

solve(equ1, x);

ratvars(a, x);
rat(equ);

equ2: subst(-1, a, equ);

solve(equ2, x);

solve(equ, a);

equ: cos(x) - x;

solve(equ, x);

load(minpack);

minpack_solve([equ], [x], [0]);

equ: sin(x) - 1/2;

solve(equ, x);

load(to_poly_solve);

sols: to_poly_solve(equ, x);

z1: part(part(sols, 1)[1], 2, 1, 3);
z2: part(part(sols, 2)[1], 2, 1, 3);
facts(z1);
facts(z2);

family(b, z) := (1-b)*subst(z, z1, rhs(part(sols, 1)[1])) + b*subst(z, z2, rhs(part(sols, 2)[1]));

family(1,3);

sin(%);

solve(sin(x)-1/3, x);

float(%);

equ: sin(x)^3 - 3*sin(x) + 1 = 3;

solve(equ, x);

float(%);

to_poly_solve(equ, x);

solve(equ, sin(x));

multiplicities;

sys: [a[1,1]*x[1]+a[1,2]*x[2] = b[1], a[2,1]*x[1]+a[2,2]*x[2] = b[2]];

solve(sys, [x[1], x[2]]);

sys: [a[1,1]*x[1]+a[1,2]*x[2]+a[1,3]*x[3] = b[1], a[2,1]*x[1]+a[2,2]*x[2]+a[2,3]*x[3] = b[2], a[3,1]*x[1]+a[3,2]*x[2]+a[3,3]*x[3] = b[3]];

solve(sys, [x[1], x[2], x[3]]);
linsolve(sys, [x[1], x[2], x[3]]);
algsys(sys, [x[1], x[2], x[3]]);

sys: [x^2 + x^3 - y^2, (x-1)^2 + y^2 - 1];

load(implicit_plot);

implicit_plot(sys, [x, -2, 2], [y, -2, 2]);

solve(sys, [x, y]);
multiplicities;

load(grobner);

gb: poly_reduced_grobner(sys, [x, y]);

sy: solve(gb[2], y);
multiplicities;

sx: map(lambda([t], rhs(solve(subst(rhs(t), y, gb[1]), x)[1])), sy);

sols: makelist([sx[i], rhs(sy[i])], i, 1, length(sx));

float(sols);