Can anyone help me solve the following system of equations numerically?

59 Views Asked by At

I have the following 4 equations:

\begin{eqnarray} z &=& c_0 + c_1x + c_2y + c_3xy + c_4x^2 + c_5y^2 \\ 2(x-x_0) &=& \lambda(c_1 + c_3y + 2c_4x) \\ 2(y-y_0) &=& \lambda(c_2 + c_3x + 2c_5y) \\ 2(z-z_0) &=& -\lambda \end{eqnarray}

where $x, y, z$, and $\lambda$ are unknown, $c_i$ are known coefficients, and $\mathbf{x}_0\!=\!(x_0, y_0, z_0)$ is also known. The system is what results when trying to derive the nearest point to $\mathbf{x}_0$ on the surface defined by the first equation. Note that $\mathbf{x}_0$ does not lie on the surface, and therefore does not satisfy the first equation.

I originally posted here, hoping to find an analytical approach to solving this non-linear system, but to no avail. Can anyone advise me on solving this numerically? I have no experience with solving non-linear systems of equations.

1

There are 1 best solutions below

3
On BEST ANSWER

Eliminating the variables from the second, third and fourth equations $$x=\frac{-c_2 c_3 \lambda ^2-2 (c_1+c_3y_0) \lambda -4 x_0}{c_3(c_3+2 c_5) \lambda ^2+4 c_4 \lambda -4}$$

$$y=\frac{2 (x-x_0)}{c_3 \lambda }-\frac{2 c_4 x+c_1}{c_3}$$ $$z=z_0-\frac \lambda 2$$

Replace $x,y,z$ in the first equation to get an ugly polynomial in $\lambda$ of degree $5$.

Have fun !