1
$\begingroup$

I have the following expression:

expr1 = Simplify[RotationMatrix[angle*x/n, {a, b, c}], {angle \[Element] Reals, x \[Element] Reals, n \[Element] PositiveIntegers, a \[Element] Reals, b \[Element] Reals, c \[Element] Reals, 0 <= x <= 1}]

which I then want to further simplify by stating that the vector {a,b,c} is a unit-vector:

expr2 = Simplify[expr1, a^2 + b^2 + c^2 == 1]

This works as expected. But if I put the unit-vector-constraint in the list of assumptions of the first expression directly, it will not end in the same result. So this:

expr3 = Simplify[RotationMatrix[angle*x/n, {a, b, c}], {a^2 + b^2 + c^2 == 1, angle \[Element] Reals, x \[Element] Reals, n \[Element] PositiveIntegers, a \[Element] Reals, b \[Element] Reals, c \[Element] Reals, 0 <= x <= 1}]

Will not simplify to the same expression as expr2. Why is that ?

$\endgroup$
3
  • $\begingroup$ It is rather simple. If you evaluate RotationMatrix[angle*x/n, {a, b, c}] you will see that it has no such a construct as a^2 + b^2 + c^2 in the explicit form. In the best case, you can find something like Abs[a]^2 + Abs[b]^2 + Abs[c]^2. Account for the condition like a^2 + b^2 + c^2 == 1 requires that the corresponding part of your expression exactly fits the left-hand part of the condition. Which in your example is not the case. In contrast, after the first simplification, you get such explicit expressions and, therefore, you can simplify further. $\endgroup$ Mar 19 at 16:09
  • $\begingroup$ Simplify[expr3 - expr2, {a^2 + b^2 + c^2 == 1}] produces {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}. $\endgroup$
    – user64494
    Mar 19 at 16:22
  • $\begingroup$ hmm, shouldn't Simplify try to simplify as much as possible ? And what is also weird is that expr3 actually is more complicated than expr1. so the extra constraint of x^2+y^2+z^2==1 made it even more complicated... $\endgroup$
    – Lenny
    Mar 19 at 16:48
1
$\begingroup$

The following will also get you to a similar expression, perhaps a bit faster:

Assuming[a^2 + b^2 + c^2 == 1,
 Simplify@
  ComplexExpand[RotationMatrix[angle*x/n, {a, b, c}], TargetFunctions -> {Re, Im}]
]

If you want something closer to the output of your second Simplify, you can specify that you want to minimize the number of times $a,b,c$ appear in your expression:

Assuming[a^2 + b^2 + c^2 == 1,
 Simplify[
  ComplexExpand[RotationMatrix[angle*x/n, {a, b, c}], TargetFunctions -> {Re, Im}],
  ComplexityFunction -> (10 Count[#, a | b | c, Infinity] + LeafCount[#] &)
 ]
]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.