4
$\begingroup$

In my work I came across that sequence

$-1,-1,-1,-1,1,1,1,1,\dots$ and repeating this 8-block so on forever

Now I cant find an ( e.g. trigonometric/complex ) expression $f(n)$ ( e.g. $f(n) =(-1)^g(n)$ ) which gives me the sequence starting with $n=2,3,4,5,6,7,8,9,…$ and so on forever.

$\endgroup$
3
$\begingroup$

Modified to start at $n=2$:$$f(n)=(-1)^{\frac{(n+2)!}{(n-2)!4!}}$$ This will give you your desired sequence.

Here is a plot of this function.

$\endgroup$
  • $\begingroup$ Very interesting. Its really periodic with length 4 alternating odd/even. I am puzzled. But it works only when I start with $n=0$. How would I alter it when starting with $n=2$ ? f(n)=(-1)^{\frac{(n+4-2)!}{n!4!}} works in CAS. $\endgroup$ – Wolfgang Tintemann Nov 26 '15 at 0:26
  • 1
    $\begingroup$ I've amended the expression to start at $n=2$ $\endgroup$ – Mufasa Nov 26 '15 at 0:28
  • $\begingroup$ Is this method applicable if I start at e.g. $n=0$ and have a $2^j$-block of $-1$ followed by a $2^j$-block of $+1$ ? What is the theory behind it ? $\endgroup$ – Wolfgang Tintemann Nov 26 '15 at 0:37
  • $\begingroup$ I believe the expression $\frac{(n+2^r)!}{n!(2^r)!}$ will give you a repeated sequence of $2^r$ odd numbers followed by $2^r$ even numbers with $n=0...$ $\endgroup$ – Mufasa Nov 26 '15 at 0:46
  • $\begingroup$ Funny. Is there a proof for this ( somewhere ) ? $\endgroup$ – Wolfgang Tintemann Nov 26 '15 at 0:54
9
$\begingroup$

Consider the function $f(n)$ such that \begin{equation} f(n) = \left \{ \begin{array}[ll] (-1 & \textrm{ if } n \textrm{ mod } 8 \equiv 0,1,2,3 \\ 1 & \textrm{ if } n \textrm{ mod } 8 \equiv 4,5,6,7 \end{array} \right. \end{equation}

$\endgroup$
  • $\begingroup$ The most unambiguous way. $\endgroup$ – Ali Caglayan Nov 26 '15 at 17:04
7
$\begingroup$

I will assume that you really are starting at $2$. If the start is different, modification is easy.

Let $g(n)=\left\lfloor\frac{n+2}{4}\right\rfloor$. Here $\lfloor x\rfloor$ is the "floor" function, the greatest integer $\le x$.

Then your sequence is given by $(-1)^{g(n)}$.

$\endgroup$
6
$\begingroup$

By symmetry, we can assume $$ f(n) = a_1 \sin\frac{\pi n}{4} +a_3 \sin\frac{3\pi n}{4} +b_1 \cos\frac{\pi n}{4} +b_3 \cos\frac{3\pi n}{4}. $$ Then $$ \begin{aligned} f(1) &= \frac{a_1}{\sqrt{2}} +\frac{a_3}{\sqrt{2}} + \frac{b_1}{\sqrt{2}} -\frac{b_3}{\sqrt{2}} = -1\\ f(2) &= a_1 - a_3 = -1\\ f(3) &= \frac{a_1}{\sqrt{2}} +\frac{a_3}{\sqrt{2}} - \frac{b_1}{\sqrt{2}} +\frac{b_3}{\sqrt{2}} = -1 \\ f(4) &= -b_1 - b_3 = -1. \end{aligned} $$ So $$ \begin{aligned} a_1 &= -\frac{1}{2} -\frac{1}{\sqrt 2}, \\ a_3 &= +\frac{1}{2} -\frac{1}{\sqrt 2}, \\ b_1 &= b_3 = \frac{1}{2}. \end{aligned} $$ So $$\begin{aligned} f(n) &= \left( -\frac{1}{2} -\frac{1}{\sqrt 2} \right) \sin\frac{\pi n}{4} + \left( \frac{1}{2} -\frac{1}{\sqrt 2} \right) \sin\frac{3 \pi n}{4} + \frac{1}{2} \left( \cos\frac{\pi n}{4} + \cos\frac{3 \pi n}{4} \right) \\ &= \sin\frac{\pi n}{4} \cos\frac{\pi n}{2} -\sqrt 2 \cos\frac{\pi n}{4} \sin\frac{\pi n}{2} + \cos\frac{\pi n}{4} \cos\frac{\pi n}{2} \\ &= \sqrt 2 \left[ \sin\frac{\pi (n+1)}{4} \cos\frac{\pi n}{2} - \cos\frac{\pi n}{4} \sin\frac{\pi n}{2} \right]. \end{aligned} $$

$\endgroup$
  • $\begingroup$ ... or you could go with Rodrigo's answer. $\endgroup$ – user253751 Nov 26 '15 at 5:46
5
$\begingroup$

Let $\zeta = \mathrm{e}^{\mathrm{i} \pi/4}$ and $$f(z) = \frac{1}{4} z \left(\left(\sqrt{2}+(1-\mathrm{i})\right) z^6 +\left(-\sqrt{2}+(1+\mathrm{i})\right) z^4 \\ -\left(\sqrt{2}+(-1+\mathrm{i})\right) z^2 +\sqrt{2}+(1+\mathrm{i})\right).$$ Then $f(\zeta^n)$ is your sequence. (It even starts at $n=2$.)

Brought to you by the joys of Lagrange interpolation (on the eighth roots of $1$).

(I haven't worked through the details, but if we turn this into a trigonometric expression, it looks as if we should get something close to @user293511's answer.)

$\endgroup$
  • $\begingroup$ Does the formula look more harmoniously if the sequence starts with $n=0$ ? $\endgroup$ – Wolfgang Tintemann Nov 26 '15 at 16:24
  • $\begingroup$ @WolfgangTintemann : Not really: $\frac{-1}{2 \left(2+\sqrt{2}\right)}x \left(\left((1+2 i)+\sqrt{-4+3 i}\right) x^6 \\+\left(1+\sqrt[4]{-1}\right) x^4-\left((-1)^{3/4}-1\right) x^2+\sqrt{-4-3 i}+(1-2 i)\right)\\$. $\endgroup$ – Eric Towers Nov 26 '15 at 22:16
1
$\begingroup$

Simply observe the 3rd bit

\begin{equation} f(n) = \left \{ \begin{array}[ll] (-1 & \textrm{ if } n \land 2^3 \equiv 0 \\ 1 & \textrm{ if } n \land 2^3 \equiv 1 \end{array} \right. \end{equation}

Or (if my mathematical symbols are correct)

\begin{equation} f(n) = 2 (n \land 2^3) - 1 \end{equation}

I'm trying to express the bit-wise logical and of n with the binary number 01000.

$\endgroup$
1
$\begingroup$

By adding a third harmonic to a sine wave I came up with $\sin{x}+(\sqrt2-1)\sin3x$ which has equal value at $x = \frac\pi8, 3\frac\pi8, 5\frac\pi8, 7\frac\pi8, 17\frac\pi8, \dots$ and the negative value at the corresponding missing odd coordinates. The formula does get more complicated when you normalise the values to be $\pm1$ for $n = 2\dots8$ though:

$$f(n) =\frac{\sin(\frac{2x+5}8\pi)+(\sqrt2-1)\sin(\frac{6x+15}8\pi)}{\sin\frac\pi{8}+(\sqrt2-1)\sin\frac{3\pi}8}$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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