Is there a generic formula to calculate the distance between an arbitrary real number $x\in\mathbb{R}$ and $$\{x\in {\mathbb{R}}\mid f(x)=0\}$$ where we have little information about $f$? In fact, my primary objective is to establish an inequality between the distance above and $f(x)\cdot f(x)$. Any idea?
-
$\begingroup$ I have some questions: 1. is $f(x) * f(x)$ the convolution of $f$ with itself? 2. do you know at least if $f: \mathbb{R} \rightarrow \mathbb{R}^n$? is $n=2$? $\endgroup$– scjorgeMay 24, 2016 at 19:08
-
1$\begingroup$ Thanks. No f(x)*f(x) means arithmetic multiplication. For example f(x)=sin(x). But I would not know the exact form of f. $\endgroup$– zellMay 24, 2016 at 19:42
-
1$\begingroup$ ok :) so $f$ is a real-valued function, right? $f: \mathbb{R} \rightarrow \mathbb{R}$, right? $\endgroup$– scjorgeMay 24, 2016 at 19:45
-
1$\begingroup$ The distance between a point $a$ and a set of points $M$ is typically defined as $$d(a,M)= \min_{d \in M}(a,d)$$ Basically, you need to calculate the distance between $(x_1, 0)$ and $(x_2,f(x_2))$, which is $$\sqrt{(x_2-x_1)^2 + (f(x_2))^2}$$ and minimise it. $\endgroup$– rtybaseMay 24, 2016 at 20:05
-
$\begingroup$ Let me see if I understand your question right. In your example: Let $f(x)=\sin(x)$ then the distance of your interest for say $x=\pi$ is the distance between $\pi \in \mathbb{R}$ and the point set $\{0,\pm \pi, \pm 2\pi, \pm 3\pi, ...\}$? $\endgroup$– scjorgeMay 24, 2016 at 20:06
1 Answer
No. Consider that this problem is equivalent to finding the roots of $f$ (if you knew the distance from $x$ to the nearest root, you could check only two points to find the root).
If you know the roots and they are countable, you can of course simply sort them and quickly find the one closest to $x$.
As for finding the distance in practice, you can perform gradient descent or ascent on $f$ with a line search until you locate the root (note that you will need to look in both positive and negative directions to find the closest root -- the gradient of $f$ is not necessarily a reliable indicator of the right direction to search -- and you will need to deal with any critical point of $f$ you find along your search). Specialized algorithms can efficiently find the roots for some classes of function $f$, e.g. polynomials.
Edit: as for relating the distance to $f$, if you can bound $f'$ you can use those bounds to compute bounds on the distance, by way of the fundamental theorem of calculus. You can refine the bound by including more high-order information about $f$ at $x$.