The nearest point on curve $c=yx^s$ from point $(x_0,y_0)$

76 Views Asked by At

How can I find the nearest point on curve $$c = y x^s$$ from a point $(x_0,y_0)$. Where $c$ and $s$ are constants

  • $s$ is between $0..1023$
  • $c$ is between $350..10000$

(In fact $c$ and $s$ will be integer values)

2

There are 2 best solutions below

4
On

The distance between two sets of points in $\mathbb{R^2}$ is simply $$R=\sqrt{(x-x_0)^2+(y-y_0)^2}$$ so this is the equation you need to minimize for a given $(x_0,y_0)$. The way to do this is is to take the derivative of $x$ and set it equal to zero, i.e. $\frac{d}{dx} R=0$ and solve for $x$ (you know the expression for $y$ in terms of $x$). Try to draw the situation with vectors, that might help.

If you're still stuck after trying this, let me know in the comments below.

EDIT:

Here I've plotted the original function for some $s,c$ (orange) and the derivative of $R$ (blue) - you can see the minimizing $x$ is where the orange function is zero, which is approximately $0.760939$ (which is found with the command I wrote in the comments).

enter image description here

0
On

For such huge exponents, the function is essentially the $L$ shape formed by $x=1$ and $y=0$ (not counting negative $x$), and the distance is like $\min(|x_0-1|,y_0)$.