gmean(x, y) := sqrt(x*y);

gmean;

fundef(gmean);

gmean(x, y);

'gmean(x, y);

ev(%, nouns);

gmean(13, 17);

'gmean(13, 17);

ev(%, nouns);

gmean(13.0, 17);

gmean1(x, y) := (t: x*y, sqrt(t));

gmean1(13, 17);

t;

gmean2(x, y) := block([t, s], t: x*y, 
    s: sqrt(t), 
    return(s), 
    (x+y)/2);

gmean2(13, 15);

t;

s;

gmean3(x, [y]) := block(if(length(y) > 0 and numberp(y[1])) then return(sqrt(x*y[1])) else return(sqrt(x*17)));

gmean3(13, 15);

gmean3(13);

kill(t); expT: 30 + 40*exp(-0.2*t);

subst(1.5, t, expT);

f(t) := expT;

f(1.5);

f(x) := subst(x, t, expT);

f(1.5);

f(x) := at(expT, t=x);

f(1.5);

f: lambda([t], expT);

f(1.5);

define(g(t), expT);

g(1.5);

functions;

dispfun(all);

monkey_saddle: x^3 - 3*x*y^2;

define(mky(x, y), monkey_saddle);

mky(2, 3);

plot3d(mky, [x, -2, 2], [y, -2, 2]);

plot3d(monkey_saddle, [x, -2, 2], [y, -2, 2]);

f_new(x, y) := mky(f(x), g(y)); 

f_new(2, 3);

kill(all); expsin: exp(sin(x));

diff(expsin, x);

de: 'diff(expsin, x);

ev(de, noun);

ev(de, diff);

diff(expsin);

diff(expsin, x, 10);

circle: x^2 + y^2 - 1;

diff(circle);

equ: subst(y(x), y, circle);

df: diff(equ, x);

depends(y, x);

df: diff(circle,x);

dydx: rhs(solve(df, 'diff(y, x))[1]);

dependencies;

remove(y, dependency);

dependencies;

define(f(x), expsin);

diff(f(x), x);

diff(sin, x);

diff(sin(x), x);

f(x, y) := x^4*y + x*y;

diff(f(x, y), x, 3, y, 1);

comp: h(z)$ for i: 1 thru 10 do comp: at(comp, z=h(z));

comp;

diff(comp, z);

h(z) := z^2 + 1/4;

ev(comp);

diff(comp, z);

ev(%, diff);

integrand: (x^2 - 1)/(x^3 + 1);

int: integrate(integrand, x);

'integrate(integrand, x);

ev(%, nouns);

diff(int, x);

rat(%);

rat(integrand);

integrate(integrand, x, 1, 3);

float(%);

integrate(x^2, x, a ,b);

integrate(1/x^2, x, a ,b);

integrate(1/x^2, x, -1, 1);

plot2d(1/x^2, [x, -0.5, 0.5]);

assume(a > 0, b > 0, a < b);

integrate(1/x^2, x, a ,b);

integrate(exp(cos(x)), x);

integrate(exp(cos(x)), x, 0, %pi);

quad_qag(exp(cos(x)), x, 0, %pi, 3);

hat(x) := block(
    if (x < 0) then return(0)
    elseif (x <= 1) then return(x*(-x+1))
    else return(0));

hat(-0.5);
hat(0.5);
hat(1.5);

plot2d(hat, [x, -2, 2]);

diff(hat(x), x);

integrate(hat(x), x, -2, 2);

quad_qag(hat, x, -2, 2, 3);

hat2(x) := charfun(x >= 0 and x <= 1)*x*(1-x);

hat2(-0.5);
hat2(0.5);
hat2(1.5);

plot2d(hat2, [x, -2, 2]);

diff(hat2(x), x);

gradef(charfun(x), 0);

diff(hat2(x), x);

integrate(hat2(x), x, -2, 2);

sq: (2*n^5)/(3*n^5-n^2+1);

limit(sq, n, inf);

limit(sq, n, minf);

limit(hat(x), x, 0.5);

limit(hat2(x), x, 0.5);

limit(1/x, x, 0);

limit(1/x, x, 0, plus);

limit(1/x, x, 0, minus);

limit(1/x, x, inf);

limit(1/x, x, minf);

limit((-1)^n, n, inf);

sum(i, i, 1, n);

sum(i, i, 1, n), simpsum=true;

nusum(i, i, 1, n);

unsum(%, n);

is: sum(1/n^2, n, 1, inf);

nusum(1/n^2, n, 1, inf);

sum(1/n^2, n, 1, inf), simpsum=true;

ev(is, simpsum=true);

kill(all); taylor(h(z), z, 1, 8);

taylor(F(x, y), [x, y], [a, b], 4);

g(z) := z/(1-z-z^2);

taylor(g(z), z, 1, 8);

taytorat(%);

gt: ratdisrep(%);

define(gtf(z), gt);

gtf(1.1);

g(1.1);

g(1.1) - gtf(1.1);