# Revision history [back]

### How to get coefficients of a trigonometric polynomial?

I have a trigonometric polynomial which is something like this:

A = (b1+2) * sin(x) + (b2+q) * sin(x)^2sin(x) + (b3/b1+6) * sin(x)cos(x) + b4 * cos(x)^4 + b5

I want to get the coefficients of the polynomial with respect to sin(x1) and cos(x1). Please note that all other variables should be treated as coefficients, including b1, b2, b3, b4, b5 and q. I would rather do this with coefficient() command, but my only problem is that coefficient command works for univariate polynomial. I can write:

A.coefficients(sin(x))

But I can't write A.coefficients({sin(x),cos(x)}) because it given an error. What can I do?

### How to get coefficients of a trigonometric polynomial?

I have a trigonometric polynomial which is something like this:

A = (b1+2) * sin(x) + (b2+q) * sin(x)^2sin(x) + (b3/b1+6) * sin(x)cos(x) + b4 * cos(x)^4 + b5

I want to get the coefficients of the polynomial with respect to sin(x1) and cos(x1). Please note that all other variables should be treated as coefficients, including b1, b2, b3, b4, b5 and q. I would rather do this with coefficient() command, but my only problem is that coefficient command works for univariate polynomial. I can write:

A.coefficients(sin(x))

But I can't write A.coefficients({sin(x),cos(x)}) because it given an error. What can I do?

### How to get coefficients of a multivariate trigonometric polynomial?

I have a trigonometric polynomial which is something like this:

A = (b1+2) * sin(x) + (b2+q) * sin(x)^2sin(x) + (b3/b1+6) * sin(x)cos(x) + b4 * cos(x)^4 + b5

I want to get the coefficients of the multivariate polynomial with respect to sin(x1) and cos(x1). Please note that all other variables should be treated as coefficients, including b1, b2, b3, b4, b5 and q. I would rather do this with coefficient() command, but my only problem is that coefficient command works for univariate polynomial. I can write:

A.coefficients(sin(x))

But I can't write A.coefficients({sin(x),cos(x)}) because it given an error. What can I do? do?

### How to get coefficients of a multivariate trigonometric polynomial?

I have a trigonometric polynomial which is something like this:

A = (b1+2) * sin(x) + (b2+q) * sin(x)^2sin(x) cos(x) + (b3/b1+6) * sin(x)cos(x) + b4 * cos(x)^4 + b5

I want to get the coefficients of the multivariate polynomial with respect to sin(x1) and cos(x1). Please note that all other variables should be treated as coefficients, including b1, b2, b3, b4, b5 and q. I would rather do this with coefficient() command, but my only problem is that coefficient command works for univariate polynomial. I can write:

A.coefficients(sin(x))

But I can't write A.coefficients({sin(x),cos(x)}) because it given an error. What can I do?

The answer should produce something like this: coefficient,(exponent of sin(x),exponent of cos(x)); b1+1,(1,0); b2+q,(2,1); b3/b1+6,(1,1); b4,(0,1); b5,(0,0).