Let $f(x) = -g(x)\cos(2 \pi h(x))$, where $h(x)$ and $g(x)$ are both continuous and invertible functions.

Let the "attraction basin" of a minima of $f(x)$ be defined as the set of points which lead to that minima when gradient descent is performed. Basically, the region around the minima where if you "let a ball go", it would "roll down" to the minima. (Not sure how better to explain it, if this is confusing or ambiguous let me know).

Finally, let $L(f(x))$ be a function that returns the local minima of the attraction basin of x.

For example, if $f(x) = -\cos(2\pi x)$, then minimas occur at integer coordinates so $L(f(x)) = round(x)$.

If $x = 0.4$, then $L(f(0.4)) = round(0.4) = 0$. If you performed gradient descent at 0.4, you would reach 0.

I am trying to figure out how to make this work for $f(x) = -g(x)\cos(2\pi h(x))$.

Without the $g(x)$, it is simple and $L(f(x)) = h^{-1}(round(h(x)))$, because $h(x)$ is invertible.

However, with the $g(x)$, I am stumped. How can I figure out $L(f(x))$ for that? In other words, how can I predict where the minimas and their attraction basins are?

I know that $f'(x) = 2\pi g(x) h'(x) \sin(2\pi h(x)) - g'(x) \cos(2\pi h(x))$, and the minimas come when $f'(x) = 0$. What are necessary conditions on $g(x)$ such that we can we predict the minimas of $f(x)$?

Any help is very, very much appreciated.


  • $\begingroup$ minimum is singular. Minima as well as minimums is plural. Minimas is plural of plural (that is, confusing, not part of the language). Also, it seems you are assuming $g$ and $h$ differentiable, not just continuous? $\endgroup$
    – Mirko
    Nov 11, 2019 at 3:47
  • 3
    $\begingroup$ @kos the question I think is too general. you can represent any continuous, invertible function $f(x)$ as $g(x)\cos(2\pi h(x))$ for some $g,h$ continuous and invertible. Indeed, just take $g(x) = f(x)$ and $h(x) \equiv 1$. So your question is equivalent to finding $L(f(x))$ for any $f$. $\endgroup$ Nov 14, 2019 at 19:43
  • $\begingroup$ An alternative question then: what are the necessary conditions for g(x) so that we can find L? $\endgroup$
    – Jabrove
    Nov 15, 2019 at 20:34

1 Answer 1


From your question context I think you're assuming that $g(x), h(x)$ are both continuous and differentiable on $\mathbb{R}$, and $g(x), h(x)\neq0$. Then we can try to solve this.

For your expression, one can easily discover that $g(x)$ controls the value of local maximum and local minimum, $h(x)$ controls the period for which the local minima appear.

1) Solve for all stationary points:$$f'(x)=0$$ Therefore we've got a sequence of solution, let's denote it $(x_n)$.

Case (i): Suppose $g(x)$ is an even function.

$x_0=\pm c$. Select $(x_{n_m})$ s.t. $S=\{x_{n_m}:n_m=2m, m\in\mathbb{Z\}}\subset X=\{x_n:f'(x_n)=0\}$ and $T=\{x_{n_k}:n_k=2k-1, k\in\mathbb{Z}\}\subset X=\{x_n:f'(x_n)=0\}$ (a weird definition for sequences)

Either $S$ or $T$ is the set of minima. Since this part $cos(2\pi h(x))$ must be periodic, Then we just need to identify if $h(x_i)=1$ is a minimum.

(I choose these integers because they used to be the local maxima or minima, since $h(x)$ changes the pattern of $x$, let's apply $h^{-1}(x)$ to get them back, so now they are easy to track.)

If so, then $$Maxima=h^{-1}(i+\dfrac{1}{2}),i\in\mathbb{Z}\implies L(f(x))=h^{-1}(i), for(h^{-1}(i-\dfrac{1}{2})\le x<h^{-1}(i+\dfrac{1}{2}))$$ If not, then $$Maxima=h^{-1}(i),i\in\mathbb{Z}\implies L(f(x))=h^{-1}(i-\dfrac{1}{2}), for(h^{-1}(i)>x\ge h^{-1}(i-1))$$

We can do this because $h(x)$ is invertible.

For those point in interval $(-1,1)$, we have to solve their values.

However, when $g(x)= 0$ this will fail, you need to investigate specifically at that point.

Sorry, there is not enough space to talk about odd functions, but they are similar, when $g(x)$ is an odd function, the pattern for $min<0$ is the same as $max>0$, while these two are the same in the case of even functions.

Since other functions are the combination of odd and even function, you can split them and track the local minimum sum at the end.

  • $\begingroup$ For those functions that have arbitrary symmetry point or axis, just test the point that are 1 unit from it, $\endgroup$
    – Kevin.S
    Nov 19, 2019 at 12:37
  • $\begingroup$ For those function that is not symmetric, we have to investigate each point, I can't find a good way to illustrate it. sorry... $\endgroup$
    – Kevin.S
    Nov 19, 2019 at 13:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .