Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

How to obtain the form of sin(nx) and cos(nx) from the result of FourierSeries[].

For Example,

$$\text{FourierSeries}[x,x,5]=i e^{-i x}-i e^{i x}-\frac{1}{2} i e^{-2 i x}+\frac{1}{2} i e^{2 i x}+\frac{1}{3} i e^{-3 i x}-\frac{1}{3} i e^{3 i x}-\frac{1}{4} i e^{-4 i x}+\frac{1}{4} i e^{4 i x}+\frac{1}{5} i e^{-5 i x}-\frac{1}{5} i e^{5 i x}$$

How do I obtain the form $$a_1 \cos (x)+a_2 \cos (2 x)+a_3 \cos (3 x)+a_4 \cos (4 x)+a_5 \cos (5 x)+a_0+b_1 \sin (x)+b_2 \sin (2 x)+b_3 \sin (3 x)+b_4 \sin (4 x)+b_5 \sin (5 x)$$

from the result of

  FourierSeries[x,x,5]

Thanks!

share|improve this question

closed as off-topic by belisarius, Artes, bobthechemist, Michael E2, Mr.Wizard Jan 28 at 5:55

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." – belisarius, Artes, bobthechemist, Michael E2, Mr.Wizard
If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Try: ExpToTrig[FourierSeries[x, x, 5]] –  RunnyKine Jan 28 at 0:00
1  
ComplexExpand@Re@FourierSeries[t, t, 5] –  belisarius Jan 28 at 0:01

2 Answers 2

Use FourierTrigSeries[x, x, 5]

If you need just $sin$ or $cos$ terms, FourierSinSeries and FourierCosSeries do that.

share|improve this answer
    
Very nice,thanks –  user10483 Jan 28 at 3:04
ExpToTrig[FourierSeries[x, x, 5]]
share|improve this answer
    
That is right,thanks –  user10483 Jan 28 at 3:05

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