Some pretty obvious commands are: simplify, expand, factor
> factor(x^4+4);
2 2
(x - 2 x + 2) (x + 2 x + 2)
> expand(sin(x+y));
sin(x) cos(y) + cos(x) sin(y)
Sometimes simplify(expand(expr)) differs from simplify(expr).
The opposite of expand is combine, in some sense.
For simplification of rational expressions, use normal:
> normal((x+1)/y+x/(x+y));
2
x + 2 x y + x + y
------------------
y (x + y)
> collect(pol,var); returns the multivariate polynomial pol written as a univariate one, in the variable var. More advanced uses are possible.
> collect(y^2*x^2+7*x*y+a*y^2-y+u*x,y);
2 2
(a + x ) y + (7 x - 1) y + u x
SOME MATHEMATICAL FUNCTIONS
> diff(f,x); means ``differentiate f with respect to x''
> diff(f,x$n); yields the n:th derivative.
> grad(f,[x1,x2]); computes the gradient of f w.r.t. [x1,x2].
> jacobian(f,[x1,x2]); jacobian matrix of the vector f.
> laplace(f,t,s); yields the laplace transform of
> int(f,x); int(f,x=a..b); indefinite and definite integration
For numerical integration apply evalf. For complex integration, apply evalc.
> sum(f,i); sum(f,i=a..b); indefinite and definite summation
For products use product which has the same syntax as sum.
> limit(f,x=a); limit of f as x goes to a
> limit(f,x=a,right); a directional limit
> taylor(f,x=a,n); a Taylor expansion of f
about x=a to
See also series for more general series expansions.
> int(sin(x)*x,x);
sin(x) - x cos(x)
> evalf(int(sin(x)/x,x=0..1),15);
.946083070367183
> sum(binomial(n,k)*x^k,k=0..n);
n
(1 + x)