Back to functions
# coeffs

### coefficients

#### Usage: nerdamer("coeffs(polynomial, x)")

#### Parameters

Get the coefficients of a polynomial. The coefficients will be placed in the index of their power. So constants are in the 0th place, x^2 would be in the 2nd place, etc. Throws an error if expression is not a polynomial. Holes will be filled with zeroes. Coeffs returns a vector so the methods vecget and vecset can be used to access it's elements.

expression polynomial | The polynomial for which the coefficients are to be found. |

expression x | The respective variable with which to get the coefficients |

EXAMPLES:

```
var coeffs = nerdamer.coeffs('3*x^2+1', 'x');
console.log(coeffs.toString());
coeffs.each(function(e, i) {
console.log('coeff #'+i+': ', nerdamer(e).add('t').toString());
});
var poly = nerdamer('a*x^2+b*x+c+x');
coeffs = nerdamer.coeffs(poly, 'x');
console.log(coeffs.toString());
coeffs = nerdamer.coeffs('a*x+b/x^2', 'x');
var p = nerdamer('vecget(coeffs(7*x^2+3*x+11, x), 2)');
console.log(p.toString());
```