Sponsored links: Algebra eBooks ### The Maxima on-line user's manual

Algebra Calculator

#### Search: #### Ratcoef

Function: ratcoef (<expr>, <x>, <n>)

Function: ratcoef (<expr>, <x>) Returns the coefficient of the expression `<x>^<n>` in the expression <expr>. If omitted, <n> is assumed to be 1.

The return value is free (except possibly in a non-rational sense) of the variables in <x>. If no coefficient of this type exists, 0 is returned.

`ratcoef` expands and rationally simplifies its first argument and thus it may produce answers different from those of `coeff` which is purely syntactic. Thus `ratcoef ((x + 1)/y + x, x)` returns `(y + 1)/y` whereas `coeff` returns 1.

`ratcoef (<expr>, <x>, 0)`, viewing <expr> as a sum, returns a sum of those terms which do not contain <x>. Therefore if <x> occurs to any negative powers, `ratcoef` should not be used.

Since <expr> is rationally simplified before it is examined, coefficients may not appear quite the way they were envisioned.

Example:

```          (%i1) s: a*x + b*x + 5\$
(%i2) ratcoef (s, a + b);
(%o2)                           x```

```(%o1)                                true
(%i2) ```

### Related Examples

##### ratcoef-sqrt

ratcoef(x*(x-(33-sqrt...

Calculate

##### ratcoef

eq1:((v-v0)/Ta*T) + v...

ratcoef(eq1,T);

Calculate

##### ratcoef-sqrt

f(x):=x*(x-(33-sqrt(4...

f((33-sqrt(495+66*sqr...

ratcoef(x*(x-(33-sqrt...

Calculate

##### ratcoef-sqrt

ratcoef(x*(x-(33-sqrt...

Calculate

##### ratcoef

s: a*x + b*x*x + 5;

ratcoef (s, a + b);

Calculate

##### ratcoef-sqrt

ratcoef(x*(x-(33-sqrt...

Calculate

##### ratcoef

poly:(x-a)*(x-b)*(x-c...

ratcoef(poly,x);

Calculate

##### ratcoef-sqrt

ratcoef(x*(x-(33-sqrt...

Calculate

##### ratcoef-ratsimp

poly:(x-a)*(x-b)*(x-c...

ratsimp(poly);

ratcoef(poly,1);

Calculate

##### ratcoef-sqrt

ratcoef(x*(x-(33-sqrt...

Calculate 