I'd like to find the interpolation weights of a trilinear interpolation of a 3D-vector field.
I'm given the vectors $x_1,x_2,x_3,x_4,x_5,x_6,x_7,x_8,x\in\mathbf{R}^3$ and I want to find the scalar values $a,b,c\in\mathbf{R}$ such that $$ x=(1-a)(1-b)(1-c)x_1+a(1-b)(1-c)x_2+(1-a)b(1-c)x_3+ab(1-c)x_4+(1-a)(1-b)cx_5+a(1-b)cx_6+(1-a)bcx_7+abcx_8 .$$ By collecting the terms for $a,b,c$, I can rewrite this problem as following: $$0=z_0+az_1+bz_2+cz_3+abz_4+acz_5+bcz_6+abcz_7$$ This is system of three polynomials of degree one in three variables.
Mathematica is able to solve the above statement in 2D (bilinear interpolation on a 2D-vector field), and it gives two relatively simple analytic solutions to $a$ and $b$. But there is only one valid solution of $a,b$ withing $[0,1]^2$ if it exists at all.
In the 3D as described above, Mathematica gives up after half an hour of computation. Is there a clever way to find all four (I think) analytic solutions to $a,b,c$ in the above problem? Thank you.
Let's consider the equation after you've collected terms. $$0=z_0+az_1+bz_2+cz_3+abz_4+acz_5+bcz_6+abcz_7$$ This is not a single equation. Since these are vectors in $\Bbb R^3$, you actually have 3 equations in 3 unknowns. Alas, you've used $x$ & $z$ as vectors, so I can't use them in their traditional coordinate roles, and I hate having to deal with multiple indices, so label $$z_0 =\begin{bmatrix}r_0\\s_0\\t_0\end{bmatrix}$$ etc. Your three equations are $$0 = r_0 + r_1a+r_2b+r_3c +r_4ab+r_5ac+r_6bc +r_7abc\\0 = s_0 + s_1a+s_2b+s_3c +s_4ab+s_5ac+s_6bc+s_7abc\\0 = t_0 + t_1a+t_2b+t_3c +t_4ab+t_5ac+t_6bc +t_7abc$$ Solve the first equation for $a$: $$a = -\frac{r_0+r_2b+r_3c+r_6bc}{r_1 + r_4b+r_5c+r_7bc}$$ and substitute in the 2nd equation $$0 = s_0+s_2b+s_3c+s_6bc - (s_1 +s_4b+s_5c+s_7bc)\frac{r_0+r_2b+r_3c+r_6bc}{r_1 + r_4b+r_5c+r_7bc}\\ (s_0+s_2b+s_3c+s_6bc)(r_0+r_2b+r_3c+r_6bc) = (s_1 +s_4b+s_5c+s_7bc)(r_0+r_2b+r_3c+r_6bc)$$ This is a quadratic equation in $b$. Its two solutions for $b$ can be substituted for in the third equation to get an equation in $c$ only. That equation is messy, but can be solved for $c$ at least by using numeric methods such as Newton's.