1
$\begingroup$

I'm am trying to find a general expression for a periodic sequence of integers $(p, q, r, s)$.

\begin{align*} n &: 1, 2, 3, 4, 5, 6, 7, 8, 9\ldots\\ a(n)&: p, q, r, s, p, q, r, s, p \ldots \end{align*}

So far, I'm trying to base the expression on a linear combination of a constant, $\sin(\pi n/2)$, and $\cos(\pi n/2)$, but I still need a 4th basis. Any clues? Or, is there a better approach?

2 Answers 2

1

Your approach is off to a great start, here are some more specific tips that will get the job done.

The sequence $$f(n) = \frac{p - r}{2}\sin\left(\frac{n\pi}{2}\right) + \frac{p+r}{2}$$

takes values $p, \frac{p+r}{2}, r, \frac{p+r}{2}, p$, etc (so matches what we'd like for odd $n$). We can do something similar to create a function that takes the values we like for even $n$ (using cosine is probably easiest, but you have to be careful with shifting, or negatives).

$$g(n) = \frac{s - q}{2}\cos\left(\frac{n\pi}{2}\right) + \frac{q+s}{2}.$$

But even once you've found a suitable $g$, the sum $f(n) + g(n)$ won't work, because there's interference.

We can get rid of the interference by making $f(n) = 0$ when $n$ is even (when the function doesn't give terms we want), and $f(n) = 1$ when the function already gives us what we want (so when $n$ is odd). This can be accomplished by multiplying it by

$$\bar{f}(n) = \sin^2\left(\frac{n\pi}{2}\right),$$

where $\bar f(n)$ takes values $1, 0, 1, 0, \ldots$ (i.e., will be zero for even $n$, and $1$ for odd $n$). You can also see the similar

$$\bar{g}(n) = \cos^2\left(\frac{n\pi}{2}\right)$$

to get rid of the "bad" terms of $g(n)$.

Thus your sequence can be achieved by

$$\begin{align*} a(n) &= \bar f(n)f(n) + \bar g(n) g(n) \\[7pt] &= \sin^2\left(\frac{n\pi}{2}\right)\left( \frac{p - r}{2}\sin\left(\frac{n\pi}{2}\right) + \frac{p+r}{2} \right) + \cos^2\left(\frac{n\pi}{2}\right)\left( \frac{s - q}{2}\cos\left(\frac{n\pi}{2}\right) + \frac{q+s}{2} \right) \end{align*}$$

which will look rather complicated if you use the $g(x)$ and $\bar g(x)$ I have in mind. It's probably also possible to use an approach that doesn't require a $0/1$-multiplier (some kind of superposition of more trigonometric functions, maybe), but I'm not really familiar with how it would work.

Of course, one might argue it's a bit silly to use such a complicated formula when

$$a(n) = \begin{cases} p, & n \equiv 1 \pmod 4\\ q, & n \equiv 2 \pmod 4\\ r, & n \equiv 3 \pmod 4\\ s, & n \equiv 0 \pmod 4\\ \end{cases} $$

will do just fine with much less fuss, but to each their own!

  • 0
    I've written out both $g$ and $\bar g$, but since you mentioned hints, I've withheld them -- for now :)2017-01-16
  • 0
    For my own education, I'd like to hear your comments re g and g bar. Thanks!2017-01-17
  • 0
    @user109387 Edited! Those should get the job done2017-01-17
0

Let $k$ denote $n\bmod4$, then:

$a_n=\frac{(k^3-5k^2+6k)p}{2}+\frac{(-k^3+4k^2-3k)q}{2}+\frac{(k^3-3k^2+2k)r}{6}+\frac{(-k^3+6k^2-11k+6)s}{6}$


Found using WolframAlpha:

  • 0
    Fascinating. I need to study this.2017-01-17