# Create a periodic function with given minima

For a simulation, I need to create a function $r(\theta,\phi)$ that has minima at specific pairs of $(\theta,\phi)$, and that is periodic, i.e. $r(\theta,\phi) = r(\theta+2\pi,\phi)$ and $r(\theta,\phi) = r(\theta,\phi+2\pi)$ etc. At least the first and second derivatives of the function should be continuous.

How can I construct such a function? I imagine that when drawn as a surface, it will look a bit like a bowling ball, but without the sharp edges.

EDIT I can imagine several ways of creating a function with a single minimum at $(\theta_0,\phi_0)$, but I am stuck creating a function that has a second (or third) minumum at e.g. $(\theta_1,\phi_1)$, but not at $(\theta_0,\phi_1)$ or $(\theta_1,\phi_0)$

-

## 2 Answers

$$r(\theta,\phi) = (1-\cos(\theta-\theta_0))\cdot(1-\cos(\phi-\phi_0))$$

looks like a good candidate :)

-
Thank you for your suggestion! This is what I originally started with. How can I adapt it to multiple minima? –  Jonas Oct 10 '12 at 18:09

The function $r(\theta,\phi)=\sin(\theta)+\cos(\phi)$ has the periodicity wanted, and is minimized at point $(\frac{3\pi}{2}+2k\pi,\pi+2k\pi), k\in \mathbb{Z}$.

-
I apologize for not being clear. I can manage single minima, but how would I do multiples? –  Jonas Oct 10 '12 at 18:09
What do you mean multiples minima, this one as an infinity of them –  Jean-Sébastien Oct 10 '12 at 18:10
I believe he would like to have a function that has a given number of minima in $(0, 2\pi)$ –  peterm Oct 10 '12 at 18:15
@Jean-Sébastien: Yes, user44010 is correct. –  Jonas Oct 10 '12 at 19:23