How to write sin(n*pi/2) as an expression (-1)^f(n)?

Click For Summary
The discussion focuses on expressing sin(nπ/2) in terms of a function f(n) that captures its behavior for odd and even n. The participants explore the idea of using the complex expansion of sine and the properties of alternating series to simplify the expression. They conclude that sin(nπ/2) vanishes for even n, allowing them to focus only on odd n values. Ultimately, they derive a simplified summation that captures the alternating nature of the series, confirming that the solution is straightforward once the correct approach is identified.
zenterix
Messages
774
Reaction score
84
Homework Statement
While calculating the Fourier series of a function I reached the following expression (for one class of Fourier coefficients):
Relevant Equations
$$\frac{1}{n\pi}\sin{\left ( \frac{n\pi}{2} \right )}$$
I could summarize this as

##\frac{1}{n\pi}## for ##n=1, 5, 9, \ldots##

##\frac{-1}{n\pi}## for ##n=3, 7, 11, \ldots##

and ##0## for all other ##n##.

How would I go about writing this in a single expression, with ##(-1)^{f(n)}## where ##f(n)## summarizes both cases above?
 
Physics news on Phys.org
zenterix said:
How would I go about writing this in a single expression, with ##(-1)^{f(n)}## where ##f(n)## summarizes both cases above?
You wouldn’t. ##(-1)^z \neq 0## for any ##z##.
 
What you could use is the complex expansion of the sine to write
$$
\sin(n\pi/2) = \frac{e^{in\pi/2} - e^{-in\pi/2}}{2i}
= \frac{i^n - (-i)^n}{2i} = \frac 12 (i^{n-1} + (-i)^{n-1})
$$
 
Orodruin said:
You wouldn’t. ##(-1)^z \neq 0## for any ##z##.
Perhaps I phrased the question in a way that wasn't clear.

What I ultimately want to do is rewrite

$$\sum\limits_{n=1}^\infty \left (\frac{1}{n\pi} \sin{\left ( \frac{n\pi}{2} \right )}\right ) \cos{nx}$$

in a simpler way.

I was wondering if I could replace the ##\sin{\left ( \frac{n\pi}{2} \right )}## with a simpler expression.

The complex expansion does work, though I still wonder if there is not a simpler way.

I don't need to have ##(-1)^{f(n)}=0## for any ##n##. As long as ##f(n)## doesn't take on the values ##0,2,4,6,\ldots## then the summation would just skip the terms where ##\sin{\left ( \frac{n\pi}{2} \right )}=0##.

The problem is how to make ##(-1)^{f(n)}## alternate between ##1## and ##-1## as ##f(n)## traverses all odd numbers.
 
Last edited:
zenterix said:
The problem is how to make ##(-1)^{f(n)}## alternate between ##1## and ##-1## as ##f(n)## traverses all odd numbers.
Normally, you use the sequence ##2n+1## or ##2n - 1## in the summand.
 
Last edited:
For example, can we write ##f(n)=1+(2n+1\ \text{mod}\ 4)\ \text{mod}\ 3##?

Then

$$(-1)^{1+(2n+1\ \text{mod}\ 4) \text{mod}\ 3}$$

For ##n=0,1,2,\ldots##, we have

##2n+1=1,3,5,7,9,\ldots##

##2n+1\ \text{mod}\ 4= 1,3,1,3,1,3,\ldots##

##(2n+1\ \text{mod}\ 4)\ \text{mod}\ 3=1,0,1,0,1,0,\ldots##.

##1+(2n+1\ \text{mod}\ 4)\ \text{mod}\ 3=2,1,2,1,2,1,\ldots##.

I guess this isn't really simplifying anything, but it seems to work.
 
\sin (n\pi/2) vanishes for even n. Thus you need only consider <br /> \sum_{k=0}^\infty \frac{1}{(2k+1)\pi}\sin\left( \frac{(2k + 1)\pi}2 \right) = \sum_{k=0}^\infty \frac{(-1)^k}{(2k+1)\pi}.
 
  • Like
Likes FactChecker and zenterix
If you sum only over odd numbers, note that this is equivalent to summing over ##k \in\mathbb N## with ##n = 2k + 1##. Consider how your expression depends on ##k##.
 
pasmith said:
\sin (n\pi/2) vanishes for even n. Thus you need only consider <br /> \sum_{k=0}^\infty \frac{1}{(2k+1)\pi}\sin\left( \frac{(2k + 1)\pi}2 \right) = \sum_{k=0}^\infty \frac{(-1)^k}{(2k+1)\pi}.
This is indeed the solution I was looking for. It's actually simple I just missed it.
 

Similar threads

  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 22 ·
Replies
22
Views
618
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K