[Math] Distance between point and sine wave

optimization

I have a project where I need to know the exact minimal distance between a point $(e, f)$ and a sine wave $y = a + b\cdot\sin(cx+d)$

Is there any way of calculating this? If not, is there a way to approximate this?

Thanks in advance!

Edit

Following Ross' and Ben's answers, The distance between a point $(e,f)$ and a sine wave $y = a + b\cdot\sin(cx+d)$ can be calculated by defining it as a distance between two points:
$$D=\sqrt{(x-e)^2+(a+b\cdot\sin(cx+d)-f)^2}$$
The $x$ where the distance is minimal can then be calculated by $E=D^2$ and then solving $E'=0$
$$E'= 2(bc\cdot\cos(cx+d)(a+b\cdot\sin(cx+d)-f)-e+x)=0$$
$$x=e-bc\cdot\cos(cx+d)(a+b\cdot\sin(cx+d)-f)$$
This last formula can only be answered exactly in certain cases.

Best Answer

Let your point be $(e,f)$ so we don't reuse $x,y$. An approximate approach is as follows: First, find the limits of the half wave of interest. Let's say we are above the curve. You want the local minimum nearest $e$ and the local maximum on the other side of $e$. The perpendicular at a point has slope that is the inverse reciprocal of the derivative. The perpendicular from the maximum will be vertical and on one side of $(e,f)$, the perpendicular from the minimum will be on the other side of $(e,f)$ Call up your favorite one-dimensional root finder to find the $x$ value where the perpendicular goes through $(e,f)$. We have bracketed the root, so it should be easy to find. Now find the distance from $(x,y)$ to $(e,f)$