Need to figure out a formula that calculates -1,-1,+1,+1,-1,-1,+1,+1

  • Thread starter Thread starter mesa
  • Start date Start date
  • Tags Tags
    Figure Formula
AI Thread Summary
A formula is sought to generate the sequence -1, -1, +1, +1, -1, -1, +1, +1 without using piecewise functions. Initial attempts included (-1)^[2n/3] and a cosine-based approach, but the latter was noted to have incorrect notation. The discussion highlights the periodic nature of the sequence, suggesting it can be represented as a discrete Fourier series with a period of 4. Various solutions were proposed, including using trigonometric functions like cosine and sine to achieve the desired periodicity. The conversation emphasizes the potential of using complex numbers and trigonometric identities to simplify the formulation.
mesa
Gold Member
Messages
694
Reaction score
36
So I need a formula that calculates -1,-1,+1,+1,-1,-1,+1,+1,... for a value of n that is not a piece wise.

So far I have come up with (-1)^[2n/3] but I don't like using greatest integer

I also did:
[cos(n × ∏)]!
The notation is not setup correctly and anyone that knows how to do it proper let me know. It is supposed to function like this:

cos(n∏)cos((n-1)∏)cos((n-2)∏)cos((n-3)∏)... until cos((n-n)∏)

I have dug in algebraically but don't think there is a solution, anyone have any thoughts on this?
 
Mathematics news on Phys.org
-cos(n*pi/2) --> -1, 0, 1, 0 ...
-sin(n*pi/2) --> 0, -1, 0, 1 ...
 
The period for your sequence is 4, so it is represented as a discrete Fourier series:
<br /> x_n = \sum_{m = 0}^{3}{a_{m} \, \exp \left(\frac{2 \pi i \, m \, n}{4} \right)},<br />
where the coefficients are found from:
<br /> a_{m} = \frac{1}{4} \, \sum_{n = 0}^{3}{x_{n} \, \exp \left(-\frac{2 \pi i \, m \, n}{4} \right)}<br />

Do the calculation by using x_0 = x_1 = -1, x_2 = x_3 = +1 for a_{0,1,2,3}, and express the complex exponentials via trigonometric functions through the Euler identity:
<br /> e^{i \alpha} = \cos \alpha + i \sin \alpha<br />
 
Dickfore said:
The period for your sequence is 4, so it is represented as a discrete Fourier series:
<br /> x_n = \sum_{m = 0}^{3}{a_{m} \, \exp \left(\frac{2 \pi i \, m \, n}{4} \right)},<br />
where the coefficients are found from:
<br /> a_{m} = \frac{1}{4} \, \sum_{n = 0}^{3}{x_{n} \, \exp \left(-\frac{2 \pi i \, m \, n}{4} \right)}<br />

Do the calculation by using x_0 = x_1 = -1, x_2 = x_3 = +1 for a_{0,1,2,3}, and express the complex exponentials via trigonometric functions through the Euler identity:
<br /> e^{i \alpha} = \cos \alpha + i \sin \alpha<br />

I am not familiar with this. What does it do?
It looks complex.
 
<br /> i^{(n)(n+1)}<br />
 
coolul007 said:
<br /> i^{(n)(n+1)}<br />

Nice and simple.:approve:
 
nice solution, need to mention for all n>0.
 
coolul007 said:
<br /> i^{(n)(n+1)}<br />

That's awesome :)
I played with i but gave up on it (apparently too quickly!)
Very simple solution
 
You can usually get sin or cos to get you a periodic sequence nicely, especially if you don't want to use i, so here's one more way:\sqrt{2}\cos\left(\frac{\pi}{4} + \frac{n\pi}{2}\right)
 
  • #10
or my solution: cos(n*pi/2 + pi) + sin(n*pi/2 + pi)
 
Back
Top