I have a simple problem which might be a bit off topic because I'm not sure if it is a problem of my coding or my formulation, but I can't solve it for days, so I decide to ask for some help: I have two unit vectors $a$ and $b$, which are normal to each other, then when $b$ is rotated by a rotation matrix $Q$, $a$ and $b$ becomes parallel to each other, and I'd like to find the condition on $Q$. I represented $Q$ with the Euler Rodrigues parameters, below is my code:
a = {1, 0, 0};
b0 = {0, Sqrt[2]/2, -Sqrt[2]/2};(*the initial position vector of b*)
(*Next,the rotation is given by the ERP parameters,vector r given as {x,y,z}*)
r = {x, y, z};
r0 = Sqrt[1 - x^2 - y^2 - z^2];
R = {{0, -r[[3]], r[[2]]}, {r[[3]], 0, -r[[1]]}, {-r[[2]], r[[1]],
0}};(*The cross product matrix of the axis*)
Q = Simplify[(r0^2 - Dot[r, r])*IdentityMatrix[3] + 2*r0*R + 2*{{x}, {y}, {z}}.{{x, y, z}}];
MatrixForm[Q]
b = Simplify[Dot[Q, b0]]
product = Dot[a, b]
c1 = ContourPlot3D[product == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}]
Turns out the plot does not show anything, which means that this condition is not feasible, which is clearly not true. For example, according to a rough analysis, this condtion can be obtained at least via the following three rotations: firstly vector $b$ can be rotated about the direction $b_0$ for an arbitrary value; then, we rotate $b$ from $b0$ to $a$ via a rotation of 90 about the direction $Cross[b0,a]$, then, another rotation about $a$ for an arbitrary value. I have tried this which shows to have some solution; moreover, the intermediate rotation can be about other directions, as long as it can rotate $b$ from $b0$ to $a$.
So it is confusing to me why mathematica does not produce any plot. I tried to solve the constraint in terms of $x$, and found it gave me some complex number, which does not make sense. Could someone help? Thanks a lot!
Update I
no longer necessary, deleted.
Update II
after a long time of analysis, I finally found out why it does not plot. The condition above yields the two solutions of x in terms of y and z:
{{(y - z - I Abs[y - 2 y^3 + z - 2 y^2 z - 2 y z^2 - 2 z^3])/( 2 Sqrt[2] (y^2 + z^2))}, {( y - z + I Abs[y - 2 y^3 + z - 2 y^2 z - 2 y z^2 - 2 z^3])/( 2 Sqrt[2] (y^2 + z^2))}}
which are two complex numbers (The above condition is essentially a quadratic equation), making me feel that there are no real solutions. But now I found that there can be real solutions, which happens when the discriminant vanishes, and in that case, I will get a curve instead of a surface.
so my remaining question is:
the ContourPlot3d can not handle curves? but somehow it plots some curves if b0 is assigned to $[0,1,0]$, which is contradictory to this conclusion.
I need to find the real part and complex part of these two solutions. But even if I have set the global assumption
$Assumptions = _Symbol [Element] Reals;
at the beginning, the evaluation of $RE$ does not work properly, as if it does not that $x,y,z$ are real numbers. I wonder how to cope with this? Thanks a lot!
RotationMatrix[{{0, Sqrt[2]/2, -Sqrt[2]/2}, {1, 0, 0}}]
will yield the matrix that rotates{0, Sqrt[2]/2, -Sqrt[2]/2}
to point to the same direction as{1, 0, 0}
. If you want to generate the axis-angle representation of that, see this. $\endgroup$RotationMatrix[{{x, y, z}, {1, 0, 0}}]
for variablex,y,z
? As for complex expressions: that is due to the fact that Mathematica assumes everything is complex unless told otherwise; useSimplify[]
+Assuming[]
if you know your variables are real. $\endgroup$