So, the real question is:Can (1-cos(npi))=(-1)^(n+1)?

  • Thread starter Thread starter RUrubee2
  • Start date Start date
RUrubee2
Messages
5
Reaction score
0

Homework Statement



To find the Fourier series for

f(x)=
0, -2<x<0
x, 0≤x<1
1, 1≤x<2

Homework Equations



f(x)=a_0/2+Ʃ(from n=0 to ∞) (a_n*cos(npix/p) + b_n*sin(npix/p))

The Attempt at a Solution



So p=2, interval=[-2,2]

a_0=3/4,

a_n=(2/n^2pi^2)*(cos(npi/2)-1),

Here is my problem:

did the exercise twice and keep getting:

b_n=(2/n^2pi^2)(sin(npi/2)+(npi/2)*(1-cos(npi))

I have the solution:

b_n=(2/n^2pi^2)(sin(npi/2)+(npi/2)*(-1)^(n+1))

I know cos(npi)=(-1)^n

and I've been told sin(npi)=(-1)^(n+1)

My steps:

1) b_n=1/2[∫(from 0 to 1) x*sin(npix/2)dx + ∫(from 1 to 2) sin(npix/2)dx]

2) integration by parts for 1st integral and subsequent integration:

→ b_n=1/2[-(2x/npi)cos(npix/2)|(0 to 1) + (4/n^2pi^2)sin(npix/2)|(0 to 1) - (2/npi)cos(npix/2)|(1 to 2)]

3) I am left with:

b_n=1/2[(2/npi) + (4/n^2pi^2)sin(npi/2) - (2/npi)cos(npi)

after regrouping is where (1-cos(npi)) comes from.

Thus original question is:

Can (1-cosnpi)=(-1)^(n+1)? or am I mistaken somewhere?

Thank you
 
Last edited:
Physics news on Phys.org
I don't know where you got "sin(n\pi)= (-1)^{n+1}= 1- cos(n\pi)". None of those equalities is correct.

sin(n\pi)= 0 for all n, not a power of -1. cos(n\pi)= -1 if n is odd, 1 if n is even so cos(n\pi)= (-1)^n and 1+ cos(n\pi) is 2 if n is even, 0 if n is odd.
 
As I said, I "know cos(npi)=(-1)^n and I was told sin(npi)=(-1)^(n+1)" so I believe you that it is wrong. I imagine that that someone wanted to say sin(npi/2)=(-1)^(n+1)?

As for the "equalities", I was wondering, not stating, seeing as the equations "looked" similar.

Therefore, if all this is wrong, would it be possible for you to help me figure out where I went wrong?

I think it safe to say I will remove that "P.S." from the question so as not to confuse...
 
Last edited:
RUrubee2 said:
I imagine that that someone wanted to say sin(npi/2)=(-1)^(n+1)?

Why would you imagine that? Try it with n = 0 or 2.
 
RUrubee2 said:

Homework Statement



To find the Fourier series for

f(x)=
0, -2<x<0
x, 0≤x<1
1, 1≤x<2

Homework Equations



f(x)=a_0/2+Ʃ(from n=0 to ∞) (a_n*cos(npix/p) + b_n*sin(npix/p))

The Attempt at a Solution



So p=2, interval=[-2,2]

a_0=3/4,

a_n=(2/n^2pi^2)*(cos(npi/2)-1),

Your an is correct but I think your a0 should be -5/4.
Here is my problem:

did the exercise twice and keep getting:

b_n=(2/n^2pi^2)(sin(npi/2)+(npi/2)*(1-cos(npi))

I have the solution:

b_n=(2/n^2pi^2)(sin(npi/2)+(npi/2)*(-1)^(n+1))

I know cos(npi)=(-1)^n

and I've been told sin(npi)=(-1)^(n+1)

My steps:

1) b_n=1/2[∫(from 0 to 1) x*sin(npix/2)dx + ∫(from 1 to 2) sin(npix/2)dx]

I didn't check your remaining steps, but what about the integral from -2 to 0?
 
Last edited:
The reason I "imagine" that is because I had some sort of logic in my head that said that if
sin(npi/2)=something, when n is an odd number than n+1 was going to give me an odd number...
I see as I try to explain that it doesn't always work. But I had "sin(npi)=(-1)^(n+1) in my class notes which is a mistake and probably didn't help my understanding...

The thing is that in my school book. It keeps telling me things like "=(-1)^(n+1).
And a similar problem to my initial question just popped up again:

Expand f(x)=x, -2<x<2
x = Odd f(x)
Thus
b_n = ∫ (0 to 2) x*sin(npix/2)dx

When I do this, I get (-4/npi)cos(npi)

and it gives me (4/npi)(-1)^(n+1)

as in original post, I was getting: (1-cos(npi)) and the answer was (-1)^(n+1)

So is it when there is a negative in front that I have to do ^(n+1)?

Could someone please respond to the actual question about where (-1)^(N+1) comes from...
 
Last edited:
@ LCKurtz
The answer in the book is 3/8 for a_0/2
And the -2 to 0 disappears 'cause the function is 0 on that interval
P.S. Thank you for trying to help me with the real question
 
RUrubee2 said:
When I do this, I get (-4/npi)cos(npi)

and it gives me (4/npi)(-1)^(n+1)
This is right.

as in original post, I was getting: (1-cos(npi)) and the answer was (-1)^(n+1)
This is wrong. You're making another error somewhere, which is causing you to mistakenly think that 1-\cos n\pi = (-1)^{n+1} must hold. You need to turn this around. The latter equality is obviously wrong, which means you must have made a mistake somewhere, so you should be looking for it.

So is it when there is a negative in front that I have to do ^(n+1)?

Could someone please respond to the actual question about where (-1)^(N+1) comes from...
It seems a bit strange that you're struggling with basic algebra when you're learning about Fourier series. There's nothing mysterious going on here:
-(-1)^n = (-1)(-1)^n = (-1)^{n+1}
 
My brain works in VERY mysterious ways, but thank you. That does clear things up.
I am working hard on trying to figure out where my mistake is.
I get confused when sometimes the answer is (-1)^(n+1)
and in other cases like:

b_n=(2/pi)∫(0 to pi)sin(nx)dx

I get (2/npi)(1-cos(npi))and the answer in that case is (2/pi)(1-(-1)^n)/n

instead of (2/pi)(1+(-1)^(n+1))/n
 
Last edited:
  • #10
RUrubee2 said:
@ LCKurtz
The answer in the book is 3/8 for a_0/2
And the -2 to 0 disappears 'cause the function is 0 on that interval
P.S. Thank you for trying to help me with the real question

For some reason I had written the function as -2 on that interval. Guess my eyeball fell on the -2 instead of the 0.
 
Back
Top