How to Find Number of Roots within a Range For Functions That Are Not Polynomials

612 Views Asked by At

Let $f(x)$ be a univariate continuous function with a certain number of double roots. For any interval $[a,b]$, can you tell how much roots of $f(x)$ are in that interval? The specific function I had in mind was $$f(x)=\sin^2(\frac{n}{x}\pi)+\sin^2(x \pi)$$ where $n$ can be any integer.

EDIT: I will also accept an algorithm that can tell, within an interval $[a,b]$, whether at least one root exists there.

2

There are 2 best solutions below

13
On BEST ANSWER

It is guaranteed that, in any given interval, if $f'$ has $n$ zeros, $f$ has at most $n+1$, but I don't think there is a general rule that applies in all contexts (apart from Bolzano's Theorem)

13
On

For your particular function, the roots occur where

$$\begin{cases}\dfrac nx=k,\\x=l\end{cases}$$ for integers $k,l$. This requires

$$n=kl.$$

If $n$ is prime, there are four solutions: $x=-n,x=-1,x=1,x=n$. Otherwise, you need to take into account all divisors of $n$, which can be found from its prime decomposition.

I doubt there is an easy way to count the roots in a given interval; this seems to be on the same order of difficulty as the distribution of the primes.


The particular case of $n=3595$ is simple: the solutions are

$$-3595,-719,-5,-1,1, 5, 719, 3595.$$

Note that rather than computing the number of solutions in $[a,b]$, you can count the solutions in $(-\infty,x]$ and deduce $[a,b]$ by subtraction.