Symbolic Eigenvalues Matlab Error - matlab

I'm trying to find the eigenvectors of a symbolic 3x3 rotation matrix in MATLAB, it appears to work for some inputs but not all, for example:
A =
[ cos(q), -sin(q), 0]
[ sin(q), cos(q), 0]
[ 0, 0, 1]
[V,lambda]=eig(A)
V =
[ 0, -i, i]
[ 0, 1, 1]
[ 1, 0, 0]
lambda =
[ 1, 0, 0]
[ 0, cos(q) - sin(q)*i, 0]
[ 0, 0, cos(q) + sin(q)*i]
this works fine, however if I try something which is not a rotation about a unit axis (x,y,z) I get the following error:
A =
[ cos(q), -sin(q), 0]
[ 0, 0, -1]
[ sin(q), cos(q), 0]
>> [V,lambda]=eig(A)
Warning: basis of eigenspace for eigenvalue cos(q)/3 - (cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + ((cos(q)/3 - cos(q)^2/9)^3 +
(cos(q)^3/27 + cos(q)^2/3 + sin(q)^2/2)^2)^(1/2))^(1/3)/2 + (cos(q)/3 - cos(q)^2/9)/(2*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 +
((cos(q)/3 - cos(q)^2/9)^3 + (cos(q)^3/27 + cos(q)^2/... [linalg::eigenvectors]
??? Error using ==> mupadmex
Error in MuPAD command: Unable to find explicit eigenvectors.
Error in ==> sym.sym>sym.mupadmexnout at 2003
out = mupadmex(fcn,args{:});
Error in ==> sym.eig at 68
[V,D,p] = mupadmexnout('mllib::eigenvectors',A);
I'm using the eigenvalues to find the axis of rotation of the matrix, and I need to use it for much more complicated systems
Any help would be appreciated.
Thanks

I am unable to reproduce the error (tested on MATLAB R2010b):
syms q
A = [cos(q) -sin(q) 0 ; 0 0 -1 ; sin(q) cos(q) 0]
[V,lambda] = eig(A)
I get the following (rather long) result:
A =
[ cos(q), -sin(q), 0]
[ 0, 0, -1]
[ sin(q), cos(q), 0]
V =
[ (3*cos(q)^2 + 4*cos(q)^3 + cos(q)^4 + 27*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(4/3) + 9*cos(q)*sin(q)^2 + 9*cos(q)*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(2/3) - 6*cos(q)^2*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3) + 9*cos(q)^2*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(2/3) + 2*cos(q)^3*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3) + 18*cos(q)*(cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))/(3*sin(q)*(cos(q)^2 - 3*cos(q) + 9*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(2/3) + 3*cos(q)*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3))*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3)), (3*cos(q)^2 - 27*3^(1/2)*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(4/3)*i + 4*cos(q)^3 + cos(q)^4 + 27*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(4/3) + 9*cos(q)*sin(q)^2 - 18*cos(q)*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(2/3) - 6*cos(q)^2*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3) - 18*cos(q)^2*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(2/3) + 2*cos(q)^3*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3) + 3*3^(1/2)*cos(q)^2*i + 4*3^(1/2)*cos(q)^3*i + 3^(1/2)*cos(q)^4*i + 18*cos(q)*(cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2) + 6*3^(1/2)*cos(q)^2*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3)*i - 2*3^(1/2)*cos(q)^3*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3)*i + 18*3^(1/2)*cos(q)*(cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2)*i + 9*3^(1/2)*cos(q)*sin(q)^2*i)/(3*sin(q)*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3)*(cos(q)^2 + 9*3^(1/2)*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(2/3)*i - 3*cos(q) + 9*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(2/3) - 6*cos(q)*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3) + 3*3^(1/2)*cos(q)*i - 3^(1/2)*cos(q)^2*i)), -(27*3^(1/2)*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(4/3)*i + 3*cos(q)^2 + 4*cos(q)^3 + cos(q)^4 + 27*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(4/3) + 9*cos(q)*sin(q)^2 - 18*cos(q)*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(2/3) - 6*cos(q)^2*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3) - 18*cos(q)^2*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(2/3) + 2*cos(q)^3*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3) - 3*3^(1/2)*cos(q)^2*i - 4*3^(1/2)*cos(q)^3*i - 3^(1/2)*cos(q)^4*i + 18*cos(q)*(cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2) - 6*3^(1/2)*cos(q)^2*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3)*i + 2*3^(1/2)*cos(q)^3*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3)*i - 18*3^(1/2)*cos(q)*(cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2)*i - 9*3^(1/2)*cos(q)*sin(q)^2*i)/(3*sin(q)*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3)*(3*cos(q) + 9*3^(1/2)*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(2/3)*i - cos(q)^2 - 9*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(2/3) + 6*cos(q)*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3) + 3*3^(1/2)*cos(q)*i - 3^(1/2)*cos(q)^2*i))]
[ -(9*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3))/(cos(q)^2 - 3*cos(q) + 9*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(2/3) + 3*cos(q)*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3)), (18*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3))/(cos(q)^2 + 9*3^(1/2)*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(2/3)*i - 3*cos(q) + 9*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(2/3) - 6*cos(q)*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3) + 3*3^(1/2)*cos(q)*i - 3^(1/2)*cos(q)^2*i), -(18*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3))/(3*cos(q) + 9*3^(1/2)*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(2/3)*i - cos(q)^2 - 9*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(2/3) + 6*cos(q)*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + (cos(q)^5/27 + (2*cos(q)^4)/27 + (cos(q)^3*sin(q)^2)/27 + cos(q)^3/27 + (cos(q)^2*sin(q)^2)/3 + sin(q)^4/4)^(1/2))^(1/3) + 3*3^(1/2)*cos(q)*i - 3^(1/2)*cos(q)^2*i)]
[ 1, 1, 1]
lambda =
[ cos(q)/3 + (cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + ((cos(q)/3 - cos(q)^2/9)^3 + (cos(q)^3/27 + cos(q)^2/3 + sin(q)^2/2)^2)^(1/2))^(1/3) - (cos(q)/3 - cos(q)^2/9)/(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + ((cos(q)/3 - cos(q)^2/9)^3 + (cos(q)^3/27 + cos(q)^2/3 + sin(q)^2/2)^2)^(1/2))^(1/3), 0, 0]
[ 0, cos(q)/3 - (cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + ((cos(q)/3 - cos(q)^2/9)^3 + (cos(q)^3/27 + cos(q)^2/3 + sin(q)^2/2)^2)^(1/2))^(1/3)/2 + (cos(q)/3 - cos(q)^2/9)/(2*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + ((cos(q)/3 - cos(q)^2/9)^3 + (cos(q)^3/27 + cos(q)^2/3 + sin(q)^2/2)^2)^(1/2))^(1/3)) - (3^(1/2)*((cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + ((cos(q)/3 - cos(q)^2/9)^3 + (cos(q)^3/27 + cos(q)^2/3 + sin(q)^2/2)^2)^(1/2))^(1/3) + (cos(q)/3 - cos(q)^2/9)/(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + ((cos(q)/3 - cos(q)^2/9)^3 + (cos(q)^3/27 + cos(q)^2/3 + sin(q)^2/2)^2)^(1/2))^(1/3))*i)/2, 0]
[ 0, 0, cos(q)/3 - (cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + ((cos(q)/3 - cos(q)^2/9)^3 + (cos(q)^3/27 + cos(q)^2/3 + sin(q)^2/2)^2)^(1/2))^(1/3)/2 + (cos(q)/3 - cos(q)^2/9)/(2*(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + ((cos(q)/3 - cos(q)^2/9)^3 + (cos(q)^3/27 + cos(q)^2/3 + sin(q)^2/2)^2)^(1/2))^(1/3)) + (3^(1/2)*((cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + ((cos(q)/3 - cos(q)^2/9)^3 + (cos(q)^3/27 + cos(q)^2/3 + sin(q)^2/2)^2)^(1/2))^(1/3) + (cos(q)/3 - cos(q)^2/9)/(cos(q)^2/3 + cos(q)^3/27 + sin(q)^2/2 + ((cos(q)/3 - cos(q)^2/9)^3 + (cos(q)^3/27 + cos(q)^2/3 + sin(q)^2/2)^2)^(1/2))^(1/3))*i)/2]

The problematic example you gave is not a general rotation matrix, 1 is not an eigenvalue. See more here http://en.wikipedia.org/wiki/Rotation_matrix. This shouldn't affect the matlab function however, you are guaranteed a basis of generalized eigenvectors over the complex numbers. Do you have any more information about the error? I'm noticing some calls to symmetric matrix-based functions, have you tried calling eig with the option 'qz' to explicitly call the non-symmetric based algorithm?

Related

reframing of polynomial equation using matlab

I am trying to reframe a polynomial equation using MATLAB. For example I have the following polynomial equation:
758622.2445*x2+-418477.9101*x2^2+27.50552059*x1-29.66792273*x1*x2+7.993937155*x1*x2^2-0.01387653551*x1^2+0.007688875184*x1^2*x2+-458420.9152*1+9.035554275e-08*x1^3+76949.5016*x2^3=y
I want to rewrite this equation to find x1 with respect to x2 and y. Is there a way in MATLAB that I can do this?
Regards,
Vivekram
You can do it with symbolic maths:
syms x1 x2 y
eq=758622.2445*x2+-418477.9101*x2^2+27.50552059*x1-29.66792273*x1*x2+7.993937155*x1*x2^2-0.01387653551*x1^2+0.007688875184*x1^2*x2+-458420.9152*1+9.035554275e-08*x1^3+76949.5016*x2^3-y; %note the "-y"
Then solve for x1:
answers=solve(eq,'x1');
This gives a somehow slightly impractical answer:
((373607477110716017672192*x2)/3413535892992763 + ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^2/9 - (100667469031835544059904*x2^2)/3413535892992763 - 1039129188224775258898432/10240607678978289)/((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 + (((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^2 - ((373607477110716017672192*x2)/3413535892992763 + ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^2/9 - (100667469031835544059904*x2^2)/3413535892992763 - 1039129188224775258898432/10240607678978289)^3)^(1/2) - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^(1/3) - (290477491679118196736*x2)/10240607678978289 + ((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 + (((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^2 - ((373607477110716017672192*x2)/3413535892992763 + ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^2/9 - (100667469031835544059904*x2^2)/3413535892992763 - 1039129188224775258898432/10240607678978289)^3)^(1/2) - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^(1/3) + 524240689526195486720/10240607678978289
524240689526195486720/10240607678978289 - ((373607477110716017672192*x2)/3413535892992763 + ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^2/9 - (100667469031835544059904*x2^2)/3413535892992763 - 1039129188224775258898432/10240607678978289)/(2*((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 + (((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^2 - ((373607477110716017672192*x2)/3413535892992763 + ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^2/9 - (100667469031835544059904*x2^2)/3413535892992763 - 1039129188224775258898432/10240607678978289)^3)^(1/2) - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^(1/3)) - (3^(1/2)*(((373607477110716017672192*x2)/3413535892992763 + ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^2/9 - (100667469031835544059904*x2^2)/3413535892992763 - 1039129188224775258898432/10240607678978289)/((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 + (((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^2 - ((373607477110716017672192*x2)/3413535892992763 + ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^2/9 - (100667469031835544059904*x2^2)/3413535892992763 - 1039129188224775258898432/10240607678978289)^3)^(1/2) - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^(1/3) - ((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 + (((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^2 - ((373607477110716017672192*x2)/3413535892992763 + ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^2/9 - (100667469031835544059904*x2^2)/3413535892992763 - 1039129188224775258898432/10240607678978289)^3)^(1/2) - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^(1/3))*i)/2 - ((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 + (((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^2 - ((373607477110716017672192*x2)/3413535892992763 + ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^2/9 - (100667469031835544059904*x2^2)/3413535892992763 - 1039129188224775258898432/10240607678978289)^3)^(1/2) - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^(1/3)/2 - (290477491679118196736*x2)/10240607678978289
524240689526195486720/10240607678978289 - ((373607477110716017672192*x2)/3413535892992763 + ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^2/9 - (100667469031835544059904*x2^2)/3413535892992763 - 1039129188224775258898432/10240607678978289)/(2*((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 + (((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^2 - ((373607477110716017672192*x2)/3413535892992763 + ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^2/9 - (100667469031835544059904*x2^2)/3413535892992763 - 1039129188224775258898432/10240607678978289)^3)^(1/2) - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^(1/3)) + (3^(1/2)*(((373607477110716017672192*x2)/3413535892992763 + ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^2/9 - (100667469031835544059904*x2^2)/3413535892992763 - 1039129188224775258898432/10240607678978289)/((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 + (((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^2 - ((373607477110716017672192*x2)/3413535892992763 + ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^2/9 - (100667469031835544059904*x2^2)/3413535892992763 - 1039129188224775258898432/10240607678978289)^3)^(1/2) - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^(1/3) - ((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 + (((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^2 - ((373607477110716017672192*x2)/3413535892992763 + ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^2/9 - (100667469031835544059904*x2^2)/3413535892992763 - 1039129188224775258898432/10240607678978289)^3)^(1/2) - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^(1/3))*i)/2 - ((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 + (((18889465931478580854784*y)/3413535892992763 - (14329969042344564774680920064*x2)/3413535892992763 - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^2 - ((373607477110716017672192*x2)/3413535892992763 + ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^2/9 - (100667469031835544059904*x2^2)/3413535892992763 - 1039129188224775258898432/10240607678978289)^3)^(1/2) - ((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)^3/27 + (((290477491679118196736*x2)/3413535892992763 - 524240689526195486720/3413535892992763)*((302002407095506632179712*x2^2)/3413535892992763 - (1120822431332148053016576*x2)/3413535892992763 + 1039129188224775258898432/3413535892992763))/6 + (7904824225910305924958912512*x2^2)/3413535892992763 - (1453534988917456608983777280*x2^3)/3413535892992763 + 8659326259947631308263391232/3413535892992763)^(1/3)/2 - (290477491679118196736*x2)/10240607678978289
You can try to simplify it, not really short anyway:
(4096*2^(1/3)*(43239687967802394525920914526220464984948736*y - 1675946192130119618845437195925327723770746969889360*x2 + 929545073270215159552834175230731008239003999989360*x2^2 - 171853986154027941742866902559669863546308859847142*x2^3 + 2^(1/2)*(2*(464772536635107579776417087615365504119501999994680*x2^2 - 85926993077013970871433451279834931773154429923571*x2^3 - 837973096065059809422718597962663861885373484944680*x2 + 21619843983901197262960457263110232492474368*y + 503614772788955588295591518904028047560511199495004)^2 - (2422466427177787086135218358613229*x2^2 - 8734534331033532607369222830483568*x2 + 7873385733679407266674311240908036)^3)^(1/2) + 1007229545577911176591183037808056095121022398990008)^(1/3))/10240607678978289 - (290477491679118196736*x2)/10240607678978289 + (2^(2/3)*(9922422485720215904809854396879785984*x2^2 - 35776652619913349559784336713660694528*x2 + 32249387965150852164297978842759315456))/(10240607678978289*(43239687967802394525920914526220464984948736*y - 1675946192130119618845437195925327723770746969889360*x2 + 929545073270215159552834175230731008239003999989360*x2^2 - 171853986154027941742866902559669863546308859847142*x2^3 + 2^(1/2)*(2*(21619843983901197262960457263110232492474368*y - 837973096065059809422718597962663861885373484944680*x2 + 464772536635107579776417087615365504119501999994680*x2^2 - 85926993077013970871433451279834931773154429923571*x2^3 + 503614772788955588295591518904028047560511199495004)^2 - (2422466427177787086135218358613229*x2^2 - 8734534331033532607369222830483568*x2 + 7873385733679407266674311240908036)^3)^(1/2) + 1007229545577911176591183037808056095121022398990008)^(1/3)) + 524240689526195486720/10240607678978289
524240689526195486720/10240607678978289 - (2048*2^(1/3)*(43239687967802394525920914526220464984948736*y - 1675946192130119618845437195925327723770746969889360*x2 + 929545073270215159552834175230731008239003999989360*x2^2 - 171853986154027941742866902559669863546308859847142*x2^3 + 2^(1/2)*(2*(464772536635107579776417087615365504119501999994680*x2^2 - 85926993077013970871433451279834931773154429923571*x2^3 - 837973096065059809422718597962663861885373484944680*x2 + 21619843983901197262960457263110232492474368*y + 503614772788955588295591518904028047560511199495004)^2 - (2422466427177787086135218358613229*x2^2 - 8734534331033532607369222830483568*x2 + 7873385733679407266674311240908036)^3)^(1/2) + 1007229545577911176591183037808056095121022398990008)^(1/3))/10240607678978289 - (2^(2/3)*3^(1/2)*16124693982575426082148989421379657728*i - 2^(1/3)*3^(1/2)*(43239687967802394525920914526220464984948736*y - 1675946192130119618845437195925327723770746969889360*x2 + 929545073270215159552834175230731008239003999989360*x2^2 - 171853986154027941742866902559669863546308859847142*x2^3 + 2^(1/2)*(2*(464772536635107579776417087615365504119501999994680*x2^2 - 85926993077013970871433451279834931773154429923571*x2^3 - 837973096065059809422718597962663861885373484944680*x2 + 21619843983901197262960457263110232492474368*y + 503614772788955588295591518904028047560511199495004)^2 - (2422466427177787086135218358613229*x2^2 - 8734534331033532607369222830483568*x2 + 7873385733679407266674311240908036)^3)^(1/2) + 1007229545577911176591183037808056095121022398990008)^(2/3)*2048*i - 2^(2/3)*3^(1/2)*x2*17888326309956674779892168356830347264*i + 2^(2/3)*3^(1/2)*x2^2*4961211242860107952404927198439892992*i)/(10240607678978289*(43239687967802394525920914526220464984948736*y - 1675946192130119618845437195925327723770746969889360*x2 + 929545073270215159552834175230731008239003999989360*x2^2 - 171853986154027941742866902559669863546308859847142*x2^3 + 2^(1/2)*(2*(21619843983901197262960457263110232492474368*y - 837973096065059809422718597962663861885373484944680*x2 + 464772536635107579776417087615365504119501999994680*x2^2 - 85926993077013970871433451279834931773154429923571*x2^3 + 503614772788955588295591518904028047560511199495004)^2 - (2422466427177787086135218358613229*x2^2 - 8734534331033532607369222830483568*x2 + 7873385733679407266674311240908036)^3)^(1/2) + 1007229545577911176591183037808056095121022398990008)^(1/3)) - (2^(2/3)*(4961211242860107952404927198439892992*x2^2 - 17888326309956674779892168356830347264*x2 + 16124693982575426082148989421379657728))/(10240607678978289*(43239687967802394525920914526220464984948736*y - 1675946192130119618845437195925327723770746969889360*x2 + 929545073270215159552834175230731008239003999989360*x2^2 - 171853986154027941742866902559669863546308859847142*x2^3 + 2^(1/2)*(2*(21619843983901197262960457263110232492474368*y - 837973096065059809422718597962663861885373484944680*x2 + 464772536635107579776417087615365504119501999994680*x2^2 - 85926993077013970871433451279834931773154429923571*x2^3 + 503614772788955588295591518904028047560511199495004)^2 - (2422466427177787086135218358613229*x2^2 - 8734534331033532607369222830483568*x2 + 7873385733679407266674311240908036)^3)^(1/2) + 1007229545577911176591183037808056095121022398990008)^(1/3)) - (290477491679118196736*x2)/10240607678978289
524240689526195486720/10240607678978289 - (2048*2^(1/3)*(43239687967802394525920914526220464984948736*y - 1675946192130119618845437195925327723770746969889360*x2 + 929545073270215159552834175230731008239003999989360*x2^2 - 171853986154027941742866902559669863546308859847142*x2^3 + 2^(1/2)*(2*(464772536635107579776417087615365504119501999994680*x2^2 - 85926993077013970871433451279834931773154429923571*x2^3 - 837973096065059809422718597962663861885373484944680*x2 + 21619843983901197262960457263110232492474368*y + 503614772788955588295591518904028047560511199495004)^2 - (2422466427177787086135218358613229*x2^2 - 8734534331033532607369222830483568*x2 + 7873385733679407266674311240908036)^3)^(1/2) + 1007229545577911176591183037808056095121022398990008)^(1/3))/10240607678978289 + (2^(2/3)*3^(1/2)*16124693982575426082148989421379657728*i - 2^(1/3)*3^(1/2)*(43239687967802394525920914526220464984948736*y - 1675946192130119618845437195925327723770746969889360*x2 + 929545073270215159552834175230731008239003999989360*x2^2 - 171853986154027941742866902559669863546308859847142*x2^3 + 2^(1/2)*(2*(464772536635107579776417087615365504119501999994680*x2^2 - 85926993077013970871433451279834931773154429923571*x2^3 - 837973096065059809422718597962663861885373484944680*x2 + 21619843983901197262960457263110232492474368*y + 503614772788955588295591518904028047560511199495004)^2 - (2422466427177787086135218358613229*x2^2 - 8734534331033532607369222830483568*x2 + 7873385733679407266674311240908036)^3)^(1/2) + 1007229545577911176591183037808056095121022398990008)^(2/3)*2048*i - 2^(2/3)*3^(1/2)*x2*17888326309956674779892168356830347264*i + 2^(2/3)*3^(1/2)*x2^2*4961211242860107952404927198439892992*i)/(10240607678978289*(43239687967802394525920914526220464984948736*y - 1675946192130119618845437195925327723770746969889360*x2 + 929545073270215159552834175230731008239003999989360*x2^2 - 171853986154027941742866902559669863546308859847142*x2^3 + 2^(1/2)*(2*(21619843983901197262960457263110232492474368*y - 837973096065059809422718597962663861885373484944680*x2 + 464772536635107579776417087615365504119501999994680*x2^2 - 85926993077013970871433451279834931773154429923571*x2^3 + 503614772788955588295591518904028047560511199495004)^2 - (2422466427177787086135218358613229*x2^2 - 8734534331033532607369222830483568*x2 + 7873385733679407266674311240908036)^3)^(1/2) + 1007229545577911176591183037808056095121022398990008)^(1/3)) - (2^(2/3)*(4961211242860107952404927198439892992*x2^2 - 17888326309956674779892168356830347264*x2 + 16124693982575426082148989421379657728))/(10240607678978289*(43239687967802394525920914526220464984948736*y - 1675946192130119618845437195925327723770746969889360*x2 + 929545073270215159552834175230731008239003999989360*x2^2 - 171853986154027941742866902559669863546308859847142*x2^3 + 2^(1/2)*(2*(21619843983901197262960457263110232492474368*y - 837973096065059809422718597962663861885373484944680*x2 + 464772536635107579776417087615365504119501999994680*x2^2 - 85926993077013970871433451279834931773154429923571*x2^3 + 503614772788955588295591518904028047560511199495004)^2 - (2422466427177787086135218358613229*x2^2 - 8734534331033532607369222830483568*x2 + 7873385733679407266674311240908036)^3)^(1/2) + 1007229545577911176591183037808056095121022398990008)^(1/3)) - (290477491679118196736*x2)/10240607678978289

Symbolically calculate the inverse of a 4 x 4 matrix in MATLAB

I am trying to find the general formula of an inverse matrix of size 4 x 4. What I wrote is simply this:
A = [a b c d ; e f g h ; i l m n; o p q r];
inv(A)
However, the MATLAB console returns the following: undefined function or variable 'a'. How should I write the matrix to get the generic formula without putting in numeric values and doing this symbolically?
You are getting that error because those variables aren't defined in MATLAB... at least, not currently. You'll need to use the Symbolic Mathematics Toolbox for that. One way is to create each variable: a up to p using sym, create a 4 x 4 matrix of these variables, then find the inverse.
sym a b c d e f g h i j k l m n o p;
A = [a b c d; e f g h; i j k l; m n o p];
invA = inv(A);
However, that leads to bad coding. Defining all of those symbolic variables gets rather unwieldy. Instead, I would use sym to create a 4 x 4 matrix of variables that follow a numeric pattern, then go ahead and find the inverse of that:
>> A = sym('A%d%d', [4 4])
A =
[ A11, A12, A13, A14]
[ A21, A22, A23, A24]
[ A31, A32, A33, A34]
[ A41, A42, A43, A44]
>> invA = inv(A)
invA =
[ (A22*A33*A44 - A22*A34*A43 - A23*A32*A44 + A23*A34*A42 + A24*A32*A43 - A24*A33*A42)/(A11*A22*A33*A44 - A11*A22*A34*A43 - A11*A23*A32*A44 + A11*A23*A34*A42 + A11*A24*A32*A43 - A11*A24*A33*A42 - A12*A21*A33*A44 + A12*A21*A34*A43 + A12*A23*A31*A44 - A12*A23*A34*A41 - A12*A24*A31*A43 + A12*A24*A33*A41 + A13*A21*A32*A44 - A13*A21*A34*A42 - A13*A22*A31*A44 + A13*A22*A34*A41 + A13*A24*A31*A42 - A13*A24*A32*A41 - A14*A21*A32*A43 + A14*A21*A33*A42 + A14*A22*A31*A43 - A14*A22*A33*A41 - A14*A23*A31*A42 + A14*A23*A32*A41), -(A12*A33*A44 - A12*A34*A43 - A13*A32*A44 + A13*A34*A42 + A14*A32*A43 - A14*A33*A42)/(A11*A22*A33*A44 - A11*A22*A34*A43 - A11*A23*A32*A44 + A11*A23*A34*A42 + A11*A24*A32*A43 - A11*A24*A33*A42 - A12*A21*A33*A44 + A12*A21*A34*A43 + A12*A23*A31*A44 - A12*A23*A34*A41 - A12*A24*A31*A43 + A12*A24*A33*A41 + A13*A21*A32*A44 - A13*A21*A34*A42 - A13*A22*A31*A44 + A13*A22*A34*A41 + A13*A24*A31*A42 - A13*A24*A32*A41 - A14*A21*A32*A43 + A14*A21*A33*A42 + A14*A22*A31*A43 - A14*A22*A33*A41 - A14*A23*A31*A42 + A14*A23*A32*A41), (A12*A23*A44 - A12*A24*A43 - A13*A22*A44 + A13*A24*A42 + A14*A22*A43 - A14*A23*A42)/(A11*A22*A33*A44 - A11*A22*A34*A43 - A11*A23*A32*A44 + A11*A23*A34*A42 + A11*A24*A32*A43 - A11*A24*A33*A42 - A12*A21*A33*A44 + A12*A21*A34*A43 + A12*A23*A31*A44 - A12*A23*A34*A41 - A12*A24*A31*A43 + A12*A24*A33*A41 + A13*A21*A32*A44 - A13*A21*A34*A42 - A13*A22*A31*A44 + A13*A22*A34*A41 + A13*A24*A31*A42 - A13*A24*A32*A41 - A14*A21*A32*A43 + A14*A21*A33*A42 + A14*A22*A31*A43 - A14*A22*A33*A41 - A14*A23*A31*A42 + A14*A23*A32*A41), -(A12*A23*A34 - A12*A24*A33 - A13*A22*A34 + A13*A24*A32 + A14*A22*A33 - A14*A23*A32)/(A11*A22*A33*A44 - A11*A22*A34*A43 - A11*A23*A32*A44 + A11*A23*A34*A42 + A11*A24*A32*A43 - A11*A24*A33*A42 - A12*A21*A33*A44 + A12*A21*A34*A43 + A12*A23*A31*A44 - A12*A23*A34*A41 - A12*A24*A31*A43 + A12*A24*A33*A41 + A13*A21*A32*A44 - A13*A21*A34*A42 - A13*A22*A31*A44 + A13*A22*A34*A41 + A13*A24*A31*A42 - A13*A24*A32*A41 - A14*A21*A32*A43 + A14*A21*A33*A42 + A14*A22*A31*A43 - A14*A22*A33*A41 - A14*A23*A31*A42 + A14*A23*A32*A41)]
[ -(A21*A33*A44 - A21*A34*A43 - A23*A31*A44 + A23*A34*A41 + A24*A31*A43 - A24*A33*A41)/(A11*A22*A33*A44 - A11*A22*A34*A43 - A11*A23*A32*A44 + A11*A23*A34*A42 + A11*A24*A32*A43 - A11*A24*A33*A42 - A12*A21*A33*A44 + A12*A21*A34*A43 + A12*A23*A31*A44 - A12*A23*A34*A41 - A12*A24*A31*A43 + A12*A24*A33*A41 + A13*A21*A32*A44 - A13*A21*A34*A42 - A13*A22*A31*A44 + A13*A22*A34*A41 + A13*A24*A31*A42 - A13*A24*A32*A41 - A14*A21*A32*A43 + A14*A21*A33*A42 + A14*A22*A31*A43 - A14*A22*A33*A41 - A14*A23*A31*A42 + A14*A23*A32*A41), (A11*A33*A44 - A11*A34*A43 - A13*A31*A44 + A13*A34*A41 + A14*A31*A43 - A14*A33*A41)/(A11*A22*A33*A44 - A11*A22*A34*A43 - A11*A23*A32*A44 + A11*A23*A34*A42 + A11*A24*A32*A43 - A11*A24*A33*A42 - A12*A21*A33*A44 + A12*A21*A34*A43 + A12*A23*A31*A44 - A12*A23*A34*A41 - A12*A24*A31*A43 + A12*A24*A33*A41 + A13*A21*A32*A44 - A13*A21*A34*A42 - A13*A22*A31*A44 + A13*A22*A34*A41 + A13*A24*A31*A42 - A13*A24*A32*A41 - A14*A21*A32*A43 + A14*A21*A33*A42 + A14*A22*A31*A43 - A14*A22*A33*A41 - A14*A23*A31*A42 + A14*A23*A32*A41), -(A11*A23*A44 - A11*A24*A43 - A13*A21*A44 + A13*A24*A41 + A14*A21*A43 - A14*A23*A41)/(A11*A22*A33*A44 - A11*A22*A34*A43 - A11*A23*A32*A44 + A11*A23*A34*A42 + A11*A24*A32*A43 - A11*A24*A33*A42 - A12*A21*A33*A44 + A12*A21*A34*A43 + A12*A23*A31*A44 - A12*A23*A34*A41 - A12*A24*A31*A43 + A12*A24*A33*A41 + A13*A21*A32*A44 - A13*A21*A34*A42 - A13*A22*A31*A44 + A13*A22*A34*A41 + A13*A24*A31*A42 - A13*A24*A32*A41 - A14*A21*A32*A43 + A14*A21*A33*A42 + A14*A22*A31*A43 - A14*A22*A33*A41 - A14*A23*A31*A42 + A14*A23*A32*A41), (A11*A23*A34 - A11*A24*A33 - A13*A21*A34 + A13*A24*A31 + A14*A21*A33 - A14*A23*A31)/(A11*A22*A33*A44 - A11*A22*A34*A43 - A11*A23*A32*A44 + A11*A23*A34*A42 + A11*A24*A32*A43 - A11*A24*A33*A42 - A12*A21*A33*A44 + A12*A21*A34*A43 + A12*A23*A31*A44 - A12*A23*A34*A41 - A12*A24*A31*A43 + A12*A24*A33*A41 + A13*A21*A32*A44 - A13*A21*A34*A42 - A13*A22*A31*A44 + A13*A22*A34*A41 + A13*A24*A31*A42 - A13*A24*A32*A41 - A14*A21*A32*A43 + A14*A21*A33*A42 + A14*A22*A31*A43 - A14*A22*A33*A41 - A14*A23*A31*A42 + A14*A23*A32*A41)]
[ (A21*A32*A44 - A21*A34*A42 - A22*A31*A44 + A22*A34*A41 + A24*A31*A42 - A24*A32*A41)/(A11*A22*A33*A44 - A11*A22*A34*A43 - A11*A23*A32*A44 + A11*A23*A34*A42 + A11*A24*A32*A43 - A11*A24*A33*A42 - A12*A21*A33*A44 + A12*A21*A34*A43 + A12*A23*A31*A44 - A12*A23*A34*A41 - A12*A24*A31*A43 + A12*A24*A33*A41 + A13*A21*A32*A44 - A13*A21*A34*A42 - A13*A22*A31*A44 + A13*A22*A34*A41 + A13*A24*A31*A42 - A13*A24*A32*A41 - A14*A21*A32*A43 + A14*A21*A33*A42 + A14*A22*A31*A43 - A14*A22*A33*A41 - A14*A23*A31*A42 + A14*A23*A32*A41), -(A11*A32*A44 - A11*A34*A42 - A12*A31*A44 + A12*A34*A41 + A14*A31*A42 - A14*A32*A41)/(A11*A22*A33*A44 - A11*A22*A34*A43 - A11*A23*A32*A44 + A11*A23*A34*A42 + A11*A24*A32*A43 - A11*A24*A33*A42 - A12*A21*A33*A44 + A12*A21*A34*A43 + A12*A23*A31*A44 - A12*A23*A34*A41 - A12*A24*A31*A43 + A12*A24*A33*A41 + A13*A21*A32*A44 - A13*A21*A34*A42 - A13*A22*A31*A44 + A13*A22*A34*A41 + A13*A24*A31*A42 - A13*A24*A32*A41 - A14*A21*A32*A43 + A14*A21*A33*A42 + A14*A22*A31*A43 - A14*A22*A33*A41 - A14*A23*A31*A42 + A14*A23*A32*A41), (A11*A22*A44 - A11*A24*A42 - A12*A21*A44 + A12*A24*A41 + A14*A21*A42 - A14*A22*A41)/(A11*A22*A33*A44 - A11*A22*A34*A43 - A11*A23*A32*A44 + A11*A23*A34*A42 + A11*A24*A32*A43 - A11*A24*A33*A42 - A12*A21*A33*A44 + A12*A21*A34*A43 + A12*A23*A31*A44 - A12*A23*A34*A41 - A12*A24*A31*A43 + A12*A24*A33*A41 + A13*A21*A32*A44 - A13*A21*A34*A42 - A13*A22*A31*A44 + A13*A22*A34*A41 + A13*A24*A31*A42 - A13*A24*A32*A41 - A14*A21*A32*A43 + A14*A21*A33*A42 + A14*A22*A31*A43 - A14*A22*A33*A41 - A14*A23*A31*A42 + A14*A23*A32*A41), -(A11*A22*A34 - A11*A24*A32 - A12*A21*A34 + A12*A24*A31 + A14*A21*A32 - A14*A22*A31)/(A11*A22*A33*A44 - A11*A22*A34*A43 - A11*A23*A32*A44 + A11*A23*A34*A42 + A11*A24*A32*A43 - A11*A24*A33*A42 - A12*A21*A33*A44 + A12*A21*A34*A43 + A12*A23*A31*A44 - A12*A23*A34*A41 - A12*A24*A31*A43 + A12*A24*A33*A41 + A13*A21*A32*A44 - A13*A21*A34*A42 - A13*A22*A31*A44 + A13*A22*A34*A41 + A13*A24*A31*A42 - A13*A24*A32*A41 - A14*A21*A32*A43 + A14*A21*A33*A42 + A14*A22*A31*A43 - A14*A22*A33*A41 - A14*A23*A31*A42 + A14*A23*A32*A41)]
[ -(A21*A32*A43 - A21*A33*A42 - A22*A31*A43 + A22*A33*A41 + A23*A31*A42 - A23*A32*A41)/(A11*A22*A33*A44 - A11*A22*A34*A43 - A11*A23*A32*A44 + A11*A23*A34*A42 + A11*A24*A32*A43 - A11*A24*A33*A42 - A12*A21*A33*A44 + A12*A21*A34*A43 + A12*A23*A31*A44 - A12*A23*A34*A41 - A12*A24*A31*A43 + A12*A24*A33*A41 + A13*A21*A32*A44 - A13*A21*A34*A42 - A13*A22*A31*A44 + A13*A22*A34*A41 + A13*A24*A31*A42 - A13*A24*A32*A41 - A14*A21*A32*A43 + A14*A21*A33*A42 + A14*A22*A31*A43 - A14*A22*A33*A41 - A14*A23*A31*A42 + A14*A23*A32*A41), (A11*A32*A43 - A11*A33*A42 - A12*A31*A43 + A12*A33*A41 + A13*A31*A42 - A13*A32*A41)/(A11*A22*A33*A44 - A11*A22*A34*A43 - A11*A23*A32*A44 + A11*A23*A34*A42 + A11*A24*A32*A43 - A11*A24*A33*A42 - A12*A21*A33*A44 + A12*A21*A34*A43 + A12*A23*A31*A44 - A12*A23*A34*A41 - A12*A24*A31*A43 + A12*A24*A33*A41 + A13*A21*A32*A44 - A13*A21*A34*A42 - A13*A22*A31*A44 + A13*A22*A34*A41 + A13*A24*A31*A42 - A13*A24*A32*A41 - A14*A21*A32*A43 + A14*A21*A33*A42 + A14*A22*A31*A43 - A14*A22*A33*A41 - A14*A23*A31*A42 + A14*A23*A32*A41), -(A11*A22*A43 - A11*A23*A42 - A12*A21*A43 + A12*A23*A41 + A13*A21*A42 - A13*A22*A41)/(A11*A22*A33*A44 - A11*A22*A34*A43 - A11*A23*A32*A44 + A11*A23*A34*A42 + A11*A24*A32*A43 - A11*A24*A33*A42 - A12*A21*A33*A44 + A12*A21*A34*A43 + A12*A23*A31*A44 - A12*A23*A34*A41 - A12*A24*A31*A43 + A12*A24*A33*A41 + A13*A21*A32*A44 - A13*A21*A34*A42 - A13*A22*A31*A44 + A13*A22*A34*A41 + A13*A24*A31*A42 - A13*A24*A32*A41 - A14*A21*A32*A43 + A14*A21*A33*A42 + A14*A22*A31*A43 - A14*A22*A33*A41 - A14*A23*A31*A42 + A14*A23*A32*A41), (A11*A22*A33 - A11*A23*A32 - A12*A21*A33 + A12*A23*A31 + A13*A21*A32 - A13*A22*A31)/(A11*A22*A33*A44 - A11*A22*A34*A43 - A11*A23*A32*A44 + A11*A23*A34*A42 + A11*A24*A32*A43 - A11*A24*A33*A42 - A12*A21*A33*A44 + A12*A21*A34*A43 + A12*A23*A31*A44 - A12*A23*A34*A41 - A12*A24*A31*A43 + A12*A24*A33*A41 + A13*A21*A32*A44 - A13*A21*A34*A42 - A13*A22*A31*A44 + A13*A22*A34*A41 + A13*A24*A31*A42 - A13*A24*A32*A41 - A14*A21*A32*A43 + A14*A21*A33*A42 + A14*A22*A31*A43 - A14*A22*A33*A41 - A14*A23*A31*A42 + A14*A23*A32*A41)]
The notation here is that the first subscript denotes the row, and the second subscript denotes the column. Specifically Aij is the entry for row i and column j. I'll let you figure out the rest.

NSInvalidArgumentException : A Node can't parent itself

I would like to know what it means when we get an error like the 'NSInvalidArgumentException', reason: 'A Node can't parent itself' :
2015-03-04 01:51:33.421 FlappyPOOSwift[1789:155918] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'A Node can't parent itself: <SKSpriteNode> name:'(null)' texture:[<SKTexture> 'pipeDown' (30 x 160)] position:{0, 851} size:{60, 320} rotation:0.00'
*** First throw call stack:
(
0 CoreFoundation 0x0000000105361f35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010705bbb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000105361e6d +[NSException raise:format:] + 205
3 SpriteKit 0x0000000105c23d14 -[SKNode(setParent) setParent:] + 134
4 SpriteKit 0x0000000105c1c1ea -[SKNode addChild:] + 179
5 FlappyPOOSwift 0x00000001051754d6 _TFC14FlappyPOOSwift9GameScene10spawnPipesfS0_FT_T_ + 2294
6 FlappyPOOSwift 0x0000000105176e28 _TFFC14FlappyPOOSwift9GameScene13didMoveToViewFS0_FCSo6SKViewT_U_FT_T_ + 56
7 FlappyPOOSwift 0x0000000105176e67 _TTRXFo__dT__XFdCb__dT__ + 39
8 SpriteKit 0x0000000105c11586 -[SKRunBlock updateWithTarget:forTime:] + 99
9 SpriteKit 0x0000000105beb586 _ZN11SKCSequence27cpp_updateWithTargetForTimeEP9SKCSprited + 92
10 SpriteKit 0x0000000105be374c _ZN9SKCRepeat27cpp_updateWithTargetForTimeEP9SKCSprited + 40
11 SpriteKit 0x0000000105c3bce8 _ZN9SKCSprite6updateEd + 170
12 SpriteKit 0x0000000105bf5435 -[SKScene _update:] + 120
13 SpriteKit 0x0000000105c0f949 -[SKView(Private) _update:] + 563
14 SpriteKit 0x0000000105c0d2d9 -[SKView renderCallback:shouldBlock:] + 837
15 SpriteKit 0x0000000105c0a391 __29-[SKView setUpRenderCallback]_block_invoke + 56
16 SpriteKit 0x0000000105c36df4 -[SKDisplayLink _callbackForNextFrame:] + 256
17 QuartzCore 0x0000000109c73747 _ZN2CA7Display15DisplayLinkItem8dispatchEv + 37
18 QuartzCore 0x0000000109c7360f _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 315
19 CoreFoundation 0x00000001052c9f64 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
20 CoreFoundation 0x00000001052c9b25 __CFRunLoopDoTimer + 1045
21 CoreFoundation 0x000000010528ce5d __CFRunLoopRun + 1901
22 CoreFoundation 0x000000010528c486 CFRunLoopRunSpecific + 470
23 GraphicsServices 0x000000010c70e9f0 GSEventRunModal + 161
24 UIKit 0x0000000105da3420 UIApplicationMain + 1282
25 FlappyPOOSwift 0x000000010517a89e top_level_code + 78
26 FlappyPOOSwift 0x000000010517a8da main + 42
27 libdyld.dylib 0x0000000107847145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Thanks in advance.
hi i guess ill just show you the code
func spawnPipes() {
let pipePair = SKNode()
pipePair.position = CGPointMake(self.frame.size.width + pipeUpTexture.size().width * 2, 0)
pipePair.zPosition = -10
let height = UInt32(self.frame.size.height / 4)
let y = arc4random() % height + height
let pipeDown = SKSpriteNode (texture: pipeDownTexture)
pipeDown.setScale(2.0)
pipeDown.position = CGPointMake(0.0 , CGFloat(y) + pipeDown.size.height + CGFloat(pipeGap))
pipeDown.physicsBody = SKPhysicsBody (rectangleOfSize: pipeDown.size)
pipeDown.physicsBody?.dynamic = false
pipeDown.addChild(pipeDown)
//pipe Up
**let pipeUp = SKSpriteNode (texture: pipeUpTexture)**
pipeUp.setScale(2.0)
pipeUp.position = CGPointMake(0.0 , CGFloat(y))
pipeUp.physicsBody = SKPhysicsBody (rectangleOfSize: pipeUp.size)
pipeUp.physicsBody?.dynamic = false
pipeUp.addChild(pipeUp)
pipePair.runAction(PipesMoveAndRemove)
self.addChild(pipePair)
}
I guess the lines which are ** marked have the error but i can't see them in the Xcode. I hope you understand what I'm trying to say
My guess is that either :
You are trying to add the node to itself (as the error mention), like for example : pipeDownNode.addChild(pipeDownNode) instead of anotherNode.addChild(pipeDownNode)
You are trying to add node at the same node twice, like : aNode.addChild(pipeDownNode) and pipeDownNode.parent = aNode
Let me know if it helped. Otherwise, please add some code (where you add the node).

Boolean Algebra Expression Simplification

Hello I have to simplify the first expression which is from a 7 segment Display assignment.
upper case means it is a NOT so for example the first part ZYXW means NOT z AND NOT y AND NOT x AND NOT w. I hope that makes sense.
So the problem is i found the answer for the expression which simplifies to
a = z + x + yw + YW
however my simplification ends at a = zYX
bellow are the steps for my simplification, could someone identify the problem please.
a = ZYXW + ZYxW + ZYxw + ZyXw + ZyxW + Zyxw + zYXw + zYXW
a = ZYXW + ZYxW + ZYxw + ZyXw + ZyxW + Zyxw + zYX(w + W)
a = ZYXW + ZYxW + ZYxw + ZyXw + ZyxW + Zyxw + zYX(1)
a = ZYXW + ZYxW + ZYxw + ZyXw + ZyxW + Zyxw + zYX.1
a = ZYXW + ZYxW + ZYxw + ZyXw + ZyxW + Zyxw + zYX
a = ZYXW + ZYxW + ZYxw + ZyXw + Zyx(W + w) + zYX
a = ZYXW + ZYxW + ZYxw + ZyXw + Zyx(1) + zYX
a = ZYXW + ZYxW + ZYxw + ZyXw + Zyx.1 + zYX
a = ZYXW + ZYxW + ZYxw + ZyXw + Zyx + zYX
a = ZYW(X + x) + ZYxw + ZyXw + Zyx + zYX
a = ZYW(1) + ZYxw + ZyXw + Zyx + zYX
a = ZYW.1 + ZYxw + ZyXw + Zyx + zYX
a = ZYW + ZYxw + ZyXw + Zyx + zYX
a = ZYW + Zw(xY + Xy) + Zyx + zYX
a = ZYW + Zw(x.1 + X.1) + Zyx + zYX
a = ZYW + Zw(x + X) + Zyx + zYX
a = ZYW + Zw(1) + Zyx + zYX
a = ZYW + Zw.1 + Zyx + zYX
a = ZYW + Zw + Zyx + zYX
a = Z(YW + w + yz) + zYX
a = Z(Y.1 + yz) + zYX
a = Z(Y = yz) + zYX
a = Z(z) + zYX
a = Z + z + zYX
a = 1 + zYX
a = zYX
Hey I think this exercise is for using Karnaugh Maps. With those its quite simple. Just look here: Karnaugh Map Wiki
First you create a truth table, like the one at the start of this tutorial.
The 16 rows represent all combinations of your 4 variables. You get the result of a row, by comparing it to your function.
So 0 0 0 0 is equivalent to ZYXW and the solution would be 1 because ZYXW is in your function.
0 0 0 1 would be ZYXw which is not in your function, so the solution is 0.
0 0 1 0 would be ZYxW which is in your function, so the solution is 1.
Do this for all 16 rows. Then go ahead like in the
Tutorial.

iPhone app crash at [NSString stringWithFormat]

Hi I am getting the fowling error can any one help he in solving the issue.
when I am sending the query to server the app is crashing before sending the query to server.
> " (lldb) bt
> * thread #1: tid = 0x2503, 0x38a4f5d0 libobjc.A.dylib`objc_msgSend + 16, stop reason = EXC_BAD_ACCESS (code=1, address=0x70706118)
> frame #0: 0x38a4f5d0 libobjc.A.dylib`objc_msgSend + 16
> frame #1: 0x323169f0 Foundation`_NSDescriptionWithLocaleFunc + 52
> frame #2: 0x399dc430 CoreFoundation`__CFStringAppendFormatCore + 11160
> frame #3: 0x399538a2 CoreFoundation`_CFStringCreateWithFormatAndArgumentsAux + 74
> frame #4: 0x3231650c Foundation`+[NSString stringWithFormat:] + 60
> frame #5: 0x0012a92c App`-[merchantListViewController getMerchantsData] + 1344 at merchantListViewController.m:754
> frame #6: 0x00127a3e App`-[merchantListViewController loadMoreButtonClicked:] + 194 at merchantListViewController.m:353
> frame #7: 0x0012b0e4 App`-[merchantListViewController tableView:willDisplayCell:forRowAtIndexPath:] + 228 at
> merchantListViewController.m:903
> frame #8: 0x332565aa UIKit`-[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 514
> frame #9: 0x3323b360 UIKit`-[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1316
> frame #10: 0x332527fe UIKit`-[UITableView layoutSubviews] + 206
> frame #11: 0x3320e896 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 258
> frame #12: 0x392cc4ea QuartzCore`-[CALayer layoutSublayers] + 214
> frame #13: 0x392cc08c QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 460
> frame #14: 0x392ccfb0 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) +
> 16
> frame #15: 0x392cc99a QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 238
> frame #16: 0x392cc7ac QuartzCore`CA::Transaction::commit() + 316
> frame #17: 0x392cc610 QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*,
> unsigned long, void*) + 60
> frame #18: 0x399d0940 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
> + 20
> frame #19: 0x399cec38 CoreFoundation`__CFRunLoopDoObservers + 276
> frame #20: 0x399cef92 CoreFoundation`__CFRunLoopRun + 746
> frame #21: 0x3994223c CoreFoundation`CFRunLoopRunSpecific + 356
> frame #22: 0x399420c8 CoreFoundation`CFRunLoopRunInMode + 104
> frame #23: 0x39a9e33a GraphicsServices`GSEventRunModal + 74
> frame #24: 0x3325f290 UIKit`UIApplicationMain + 1120
> frame #25: 0x000dd2d8 App`main + 152 at main.m:15 "
this is the code for the json post request
sessionId =[[NSUserDefaults standardUserDefaults] objectForKey:#"session_id"];
shouldReloadData=NO;
[[NSNotificationCenter defaultCenter] addObserver:self selector:#selector(getMerchantsListData:) name:#"getMerchantsListData" object:nil];
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
latitude,#"latitude",
longitude,#"longitude",
//[NSString stringWithFormat:#"%d",categoryID],#"category_id",
[NSString stringWithFormat:#"%d",sortOrderID],#"sort_order",
#"5",#"page_size",
[NSString stringWithFormat:#"%#",searchMerchant.text],#"search_keyword",
[NSString stringWithFormat:#"%d",pageNumber],#"page_number",
sessionId,#"session_id",
nil];
//searchKeyword=#"";
NSLog(#"params %#",params);
[[UFNetworking dataSourceInstance] getData:params toAPI:kGetMerchantList cache:NO secure:NO notification:#"getMerchantsListData"];
first take this all value in string variable and then pass to dictionary like bellow..
NSString *sort_order = [NSString stringWithFormat:#"%d",sortOrderID];
NSString *search_keyword = [NSString stringWithFormat:#"%#",searchMerchant.text];
NSString *page_number = [NSString stringWithFormat:#"%d",pageNumber];
NSLog(#"\n\n Sort Order ==> %#, Search_keyWord ==> %#,Page_Number ==> %#",sort_order,search_keyword,page_number); /// check here what you get from the code..
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
latitude,#"latitude",
longitude,#"longitude",
//[NSString stringWithFormat:#"%d",categoryID],#"category_id",
sort_order,#"sort_order",
#"5",#"page_size",
search_keyword,#"search_keyword",
page_number,#"page_number",
sessionId,#"session_id",
nil];
i hope this answer helpful to you..
I bet you have an invalid formatter. Make sure you are not using %# on an int or something like that.
In my case, I use % in Indonesian, so I have to add %% in the localized string, hope it can help!