I am given a point $ \begin{bmatrix} u & v \end{bmatrix}^T $ which I know is in form $\begin{bmatrix} \frac{x}{f(r)} & \frac{y}{f(r)} \end{bmatrix}^T$ where $f(r)$ is polynomial function, $f(r)=a_nr^n + \cdots + a_1r + a_0$ and $r=\sqrt{x^2+y^2}$.
I want to restore $x$ and $y$ given $u$ and $v$. What I have done so far is below.
$$ u = \frac{x}{f(r)}\\ v = \frac{y}{f(r)}\\ $$
If we square both equations and sum them we get:
$$ \tag{1} f(r) = \frac1{\sqrt{u^2+v^2}}r $$
Which is:
$$ a_nr^n + \cdots + \left(a_1 - \frac1{\sqrt{u^2+v^2}}\right) r + a_0 = 0 $$
I can find the roots of a polynomial using roots()
in MATLAB. Then using Equation 1 I can find the value of $f$ and then $u$ and $v$.
When I try this with a numerical example with known polynomial coefficients I cannot restore $x$ and $y$ given $u$ and $v$, the results I am getting do not match. Am I missing something here?
I can provide the coefficients and the numbers I am using if needed.
Update: Here are my values which are not working. First polynomial coefficients $a_0, a_1, a_2$ are $-174.4486, 0, 0.0026$ respectively. Lets start with an original point $p = \begin{bmatrix} \frac{50}{-161.4486} & \frac{50}{-161.4486}\end{bmatrix}^T$. Observe that $p$ is in form described above where $f(r) = -161.4486$, you can calculate if you don't believe me :). Now my given point becomes $\begin{bmatrix}-0.3097 & -0.3097\end{bmatrix}^T$, using only this I want to find $x=50$ and $y=50$. Lets start. We calculate:
$$\frac1{\sqrt{u^2+v^2}} = 2.2832$$
We put it into the polynomial and find the roots which are $r_1= 948.875$ and $r_2=-70.7107$. Since we know $r$ is non negative we choose $r_1$, plug it into the Equation 1 and we get $f(r)=2166.5$ put it into the equations we get $-671$ for $x$ and $y$. Before calculating those values we can understand something is wrong just looking at $r$, it is not the correct value which is $70.7107$.