Sponsored links: Algebra eBooks
 

Help Index

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

The Maxima on-line user's manual

Algebra Calculator

Search:

Expand Calculator

Expand

Function: expand (<expr>)

b1(x):=(1+t)/(2*t) - x/t;
b2(x):=(x*x/t) - x*(1+t)/t + (1+3*t+t*t)/(6*t);
  	expand(2*b1(q+t+1)+b1(-q+t)-b1(q+(t/2)+(1/2))-b1(q+(t/2)+1)-b1(q+t+(1/2)));
expand(2*b2(q+t+1)+b2(-q+t)-b2(q+(t/2)+(1/2))-b2(q+(t/2)+1)-b2(q+t+(1/2)));
f(t):=t;
plot2d(sin(x)*f(1), [x, 0, 2]);

Function: expand (<expr>, <p>, <n>) Expand expression <expr>. Products of sums and exponentiated sums are multiplied out, numerators of rational expressions which are sums are split into their respective terms, and multiplication (commutative and non-commutative) are distributed over addition at all levels of <expr>.

For polynomials one should usually use ratexpand which uses a more efficient algorithm.

maxnegex and maxposex control the maximum negative and positive exponents, respectively, which will expand.

expand (<expr>, <p>, <n>) expands <expr>, using <p> for maxposex and <n> for maxnegex. This is useful in order to expand part but not all of an expression.

expon - the exponent of the largest negative power which is automatically expanded (independent of calls to expand). For example if expon is 4 then (x+1)^(-5) will not be automatically expanded.

expop - the highest positive exponent which is automatically expanded. Thus (x+1)^3, when typed, will be automatically expanded only if expop is greater than or equal to 3. If it is desired to have (x+1)^n expanded where n is greater than expop then executing expand ((x+1)^n) will work only if maxposex is not less than n.

expand(expr, 0, 0) causes a resimplification of expr. expr is not reevaluated. In distinction from ev(expr, noeval) a special representation (e. g. a CRE form) is removed. See also ev.

The expand flag used with ev causes expansion.

The file simplification/facexp.mac contains several related functions (in particular facsum, factorfacsum and collectterms, which are autoloaded) and variables (nextlayerfactor and facsum_combine) that provide the user with the ability to structure expressions by controlled expansion. Brief function descriptions are available in simplification/facexp.usg. A demo is available by doing demo("facexp").

     Examples:
          (%i1) expr:(x+1)^2*(y+1)^3;
                                                2        3
          (%o1)                          (x + 1)  (y + 1)
          (%i2) expand(expr);
                 2  3        3    3      2  2        2      2      2
          (%o2) x  y  + 2 x y  + y  + 3 x  y  + 6 x y  + 3 y  + 3 x  y
                                                           2
                                          + 6 x y + 3 y + x  + 2 x + 1

          (%i3) expand(expr,2);
                                2        3              3          3
          (%o3)                x  (y + 1)  + 2 x (y + 1)  + (y + 1)

          (%i4) expr:(x+1)^-2*(y+1)^3;
                                                    3
                                             (y + 1)
          (%o4)                              --------
                                                    2
                                             (x + 1)
          (%i5) expand(expr);
                           3               2
                          y             3 y            3 y             1
          (%o5)      ------------ + ------------ + ------------ + ------------
                      2              2              2              2
                     x  + 2 x + 1   x  + 2 x + 1   x  + 2 x + 1   x  + 2 x + 1

          (%i6) expand(expr,2,2);
                                                    3
                                             (y + 1)
          (%o6)                            ------------
                                            2
                                           x  + 2 x + 1

Resimplify an expression without expansion:

          (%i7) expr:(1+x)^2*sin(x);
                                                 2
          (%o7)                           (x + 1)  sin(x)
          (%i8) exponentialize:true;
          (%o8)                                true
          (%i9) expand(expr,0,0);
                                             2    %i x     - %i x
                                   %i (x + 1)  (%e     - %e      )
          (%o9)                  - -------------------------------
                                                  2

There are also some inexact matches for expand. Try ?? expand to see them.

(%o1)                                true
(%i2) 

Expand Example

Related Examples

expand

expand((n+1)^5 - 5*(n...

expand((n+1)^5);

Calculate

expand-solve

f(x) := x^2 + x + 1 +...

t : solve(f(x),x);

expand((x-t[1])*(x-t[...

Calculate

expand-fortran

fortran(1.2+2.4);

a:1;

b:2;

Calculate

expand-factor-sqrt

V (x) := a/4*x^2*(x-b...

x1:(1/4*(3*b-sqrt(b^2...

x2:(1/4*(3*b+sqrt(b^2...

Calculate

expand-load

load(atensor);

init_atensor(clifford...

q(a,b,c,d):=a+b.v[1]+...

Calculate

expand-integrate-sqrt

integrate(integrate(x...

integrate(x * y, y);

f(x):=integrate(x * y...

Calculate

expand

expand(- a * s + a * ...

Calculate

expand-sum

expand((x+y)*(y+z)*(z...

expand(1/x-(k/x)^2 * ...

sum(sum((1-k^2)^p,p,1...

Calculate

expand-simpsum-sum

expand(p=(1+x+x^2+x^3...

c(x, y):= x!/(y!*(x-y...

d(a, b, o, t):= sum((...

Calculate

expand

expand(((1/20)*((1+t+...

Calculate