%G_x = [u_y|u_z|u_x]
%G_y = [u_x|u_z|u_y]
%G_z = [u_x|u_y|u_z]
%H_x = [u_y|u_z|u_d]
%H_y = [u_x|u_z|u_d]
%H_z = [u_x|u_y|u_d]
%W_x = [u_y|u_z|w]
%W_y = [u_x|u_z|w]
%W_z = [u_x|u_y|w]

%Using the matrices that I defined above, the coefficients and constant term
%become (for quadratic of form a*d^2 + b*d + m = 0. c is already used.)

%a = (det(H_x)/det(G_x))^2 + (det(H_y)/det(G_y))^2 + (det(H_z)/det(G_z))^2 - (c^2)

%b = 2*((det(H_x)*det(W_x))/(det(G_x)^2)) + 2*((det(H_y)*det(W_y))/(det(G_y)^2)) + 2*((det(H_z)*det(W_z))/(det(G_z)^2))...
    %+ 2*A1*(det(H_x)/det(G_x)) + 2*B1*(det(H_y)/det(G_y)) + 2*C1*(det(H_z)/det(G_z)) + (2*(c^2)*t1)
    
%m = (det(W_x)/det(G_x))^2 + (det(W_y)/det(G_y))^2 + (det(W_z)/det(G_z))^2 + 2*A1*(det(W_x)/det(G_x))... 
    %+ 2*B1*(det(W_y)/det(G_y)) + 2*C1*(det(W_z)/det(G_z)) + A1^2 + B1^2 + C1^2 - ((c^2)*(t1^2))

%Using the quadratic formula we get 2 roots

%R1 = (-b + sqrt((b^2)-(4*a*m)))/(2*a)

%R2 = (-b - sqrt((b^2)-(4*a*m)))/(2*a)

%d = R1,R2

%Plugging these back into the equations for x,y,z in terms of d we get

%x1 = -R1*(det(H_x)/det(G_x)) - (det(W_x)/det(G_x))
%y1 = -R1*(det(H_y)/det(G_y)) - (det(W_y)/det(G_y))
%z1 = -R1*(det(H_z)/det(G_z)) - (det(W_z)/det(G_z))

%x2 = -R2*(det(H_x)/det(G_x)) - (det(W_x)/det(G_x))
%y2 = -R2*(det(H_y)/det(G_y)) - (det(W_y)/det(G_y))
%z2 = -R2*(det(H_z)/det(G_z)) - (det(W_z)/det(G_z))