Given a three dimensional curve equation how do I find the x and y given z

44 Views Asked by At

Given the equation: $$ \frac{1}{0.005 + 0.0001x} \cdot \frac{1}{y} = z $$

Is it possible to figure out the $x$ and $y$ values for a given $z$, and if the point is not on the curve find the closest points on the curve. If I plot for some values of $x$ and $y$ I get a plot like the one shown below. So given the $z$ value of $192$ is it possible for me to determine that my $x$ and $y$ points are $2$ and $1$, respectively (actually at $x=2$ and $y=1$ the $z$ value is $192.3077$, but I would like to determine the closest point that is on the curve). Likewise for a $z$ value of $200$ I would get the same point. I would like to do this for any $z$ value.

Function plot.

2

There are 2 best solutions below

0
On BEST ANSWER

If you solve the given equation $$\frac{1}{0.005 + 0.0001 x} \frac{1}{y} = z$$ for $x$, you get $$x = \frac{10000}{y z} - 50 \tag{X}\label{X}$$ and if you solve it for $y$, you get $$y = \frac{10000}{(x + 50) z} \tag{Y}\label{Y}$$ Substituting a constant $z$ into $\eqref{X}$ or $\eqref{Y}$ gives you the level curve or contour line where $z$ is constant.

If we rewrite the given equation as $$f(x, y) = z = \frac{10000}{(50 + x)y}$$ we can tell that at $x = -50$, $y = 0$, $z$ is undefined, and around that point, $z$ is antisymmetric with respect to $x$ and $y$. For this reason, if you are interested in integer $x$, $y$, $z$, it is useful to switch to new coordinate $$\chi = x + 50 \quad \iff \quad x = \chi - 50$$ so that $$z = g(\chi, y) = \frac{10000}{\chi y}$$ This is obviously antisymmetric in both $\chi$ and $y$, $f(\chi,y) = -f(-\chi,y) = -f(\chi,-y) = f(-\chi,-y)$. Because $\chi \in \mathbb{Z} \iff x \in \mathbb{Z}$, this translation does not affect 'integerness' or rounding.

To find all integer points $(\chi, y)$ that may be within one Manhattan distance unit (i.e., $x$ or $y$ off by $\pm 1$) of the contour line $g(\chi, y) = z$, calculate $C_1 = \frac{\sqrt{10000}}{\lvert z \rvert} = \frac{100}{\lvert z \rvert}$ and $C_2 = \frac{10000}{z}$, and do two double loops:

  • First outer loop is $\chi = 1 \dots \lceil C_1 \rceil + 1$, and the inner loop is $y = \left\lfloor \frac{C_2}{\chi} \right\rfloor - 1 \dots \left\lceil \frac{C_2}{\chi} \right\rceil + 1$.

  • The second outer loop is $y = 1 \dots \lceil C_1 \rceil + 1$, and the inner loop is $\chi = \left\lfloor \frac{C_2}{y} \right\rfloor -1 \dots \left\lceil \frac{C_2}{y} \right\rceil + 1$.

checking all points $\bigl(\chi, y, g(\chi, y)\bigr)$. Or, going back to the original coordinates, checking all points $\bigl(x, y, f(x, y)\bigr)$,

  • First outer loop is $x = -49 \dots \lceil C_1 \rceil - 49$, and the inner loop is $y = \left\lfloor \frac{C_2}{x + 50} \right\rfloor - 1 \dots \left\lceil \frac{C_2}{x + 50} \right\rceil + 1$.

  • The second outer loop is $y = 1 \dots \lceil C_1 \rceil + 1$, and the inner loop is $x = \left\lfloor \frac{C_2}{y} \right\rfloor -51 \dots \left\lceil \frac{C_2}{y} \right\rceil - 49$.

There are surprisingly few points $(\chi, y)$ or $(x, y)$ within those loops, so even a brute-force search to look for points that are sufficiently "close" to the surface is quite feasible.

The question of exact (minimum) Euclidean distance between point $(x, y, z)$ and surface $z = \frac{10000}{x y}$ is best asked in a separate question; but note that even then, because of the symmetries, you can safely limit to 3D octant $x \gt 0$, $y \gt 0$, $z \gt 0$.

2
On

The equation $$ \frac{1}{0.005 + 0.0001x} \cdot \frac{1}{y} = z $$ that relates the three quantities $(x, y, z)$ can be rearranged a bit to make it easier to understand.

First, multiply the fraction by $$ 1 = \frac{10000}{10000} $$ to obtain $$ \frac{10000}{50 + x} \cdot \frac{1}{y} = z, $$ which can also be written $$ \frac{10000}{(x + 50) y} = z. $$

For a given fixed value of $z$, say $z = 200$, this becomes an equation in just the variables $x$ and $y$, i.e. a curve in the $xy$-plane. We can rearrange it a bit, first taking reciprocals of both sides of the equation: $$ \frac{10000}{(x + 50) y} = 200 \quad\implies\quad \frac{(x + 50) y}{10000} = \frac{1}{200} \quad\implies\quad (x + 50) y = 50. $$ We can then write this as $$ y = \frac{50}{x + 50}, $$ a form that explicitly produces a $y$-value if you provide an $x$-value. For example, if $x = 30$, then $$ y = \frac{50}{30 + 50} = \frac{5}{8} = 0.675 $$ or if $x = 2$, then $$ y = \frac{50}{2 + 50} = \frac{25}{26} \approx 0.9615\ldots $$

The curve $(x + 50) y = 50$ is called a hyperbola. In fact, if we make a substitution $X = x + 50$, then the equation $Xy = 50$ makes this even clearer: solutions are pairs of numbers $(X, y)$ with a fixed product of $50$. If you need to convert back to $(x, y)$, then just remember the relationship: $x = X - 50$.

But the fixed value $z = 200$ was arbitrary. What does this look like for other values of $z$? The analogous process yields $$ (x + 50) y = \frac{10000}{z}, $$ and for each $z$, we have a different hyperbola curve relating $x$ and $y$. You can play around with these curves here.