Suppose I have:

f[r_, ϕ_] = C1 Cos[ϕ]r + C3 Sin[3 ϕ] r + C4 Sin[4 ϕ] r^4;

How do I extract the coefficient of a chosen trigonometric term, let's say Cos[ϕ]?


closed as off-topic by MarcoB, user9660, m_goldberg, ilian, Jens Nov 22 '15 at 2:40

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – MarcoB, Community, m_goldberg, ilian, Jens
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 5
    $\begingroup$ Coefficient[f[r, \[Phi]], Cos[\[Phi]]] $\endgroup$ – Hubble07 Nov 7 '15 at 9:23
  • $\begingroup$ @Hubble07 answer? $\endgroup$ – Yves Klett Nov 21 '15 at 11:04
  • 1
    $\begingroup$ If f is meant to be an expression obtained from a computation, then the form of the expression might determine the answer. For example, Coefficient[TrigExpand@f[r, ϕ], Cos[ϕ]]. If this is an issue, FourierCoefficient might be appropriate. $\endgroup$ – Michael E2 Nov 21 '15 at 17:37

Try the following:

 Coefficient[f[r, ϕ], Cos[ϕ]]

Not the answer you're looking for? Browse other questions tagged or ask your own question.