13
$\begingroup$

the situation is as follows

σ[i_] := PauliMatrix[i];
m := Sum[a[i]*σ[i], {i, 1, 3}]
$Assumptions = Element[{q, w, e, o}, Reals];
a[1] := q;
a[2] := w;
a[3] := e - o;

what I want is the Conjugate of the eigenvectors, so

Conjugate[Eigenvectors[m]]

and this gives

{{-((-Conjugate[e] + 
Conjugate[o + Sqrt[e^2 - 2 e o + o^2 + q^2 + w^2]])/(
Conjugate[q] - I Conjugate[w])), 
1}, {-(-Conjugate[e] + Conjugate[o] - 
  Conjugate[Sqrt[e^2 - 2 e o + o^2 + q^2 + w^2]])/(Conjugate[q] - 
  I Conjugate[w]), 1}}

now simplify, gives

{{(e - Conjugate[o + Sqrt[e^2 - 2 e o + o^2 + q^2 + w^2]])/(q - I w), 
1}, {(e - o + Sqrt[e^2 - 2 e o + o^2 + q^2 + w^2])/(q - I w), 1}}

and here comes the problem, in the second eigenvector, the "conjugate" is totally gone, and this is right. because I have assumed all the variables are real. While in the first eigenvector, there is still one "conjugate" in the expression, But this Conjugate should be simplified too without any problem.

If you copy the Conjugate part and simplify, it does simplify.

Simplify[Conjugate[o + Sqrt[e^2 - 2 e o + o^2 + q^2 + w^2]]]

and gives

o + Sqrt[e^2 - 2 e o + o^2 + q^2 + w^2]

So why Mathematica's simplify just don't take a further step in simplifying first eigenvector as it did in simplifying second eigenvector?? This kind of asymmetry confused me.

So is it a bug or something? Did I missed some step in the simplify procedure?


Edit It seems that few people are interested in my question. But I do really frequently encounter such annoying simplifying problem. So I choose another example extracted from my real calculation. And expecting more suggestions.

first, a little prelude

$Assumptions=Element[{x,y},Reals]
Simplify[Conjugate[Sqrt[x^2+y^2]]

result

Sqrt[x^2 + y^2]

This trivial example illustrates that "simplify" is smart enough to deal with Conjugate and it can recognize whether the expression in the Conjugate is real or not. But I encounter an expression which is essentially the same thing only with more variables than the above trivial example. Mathematica's simplify function failed to do it correctly.

with the global assumptions

$Assumptions = Element[{t1, t2, kx, ky, Δ, ϕ}, Reals]

Simplify[Conjugate[Sqrt[
t1^2 (2 Cos[(Sqrt[3] kx)/2] Cos[ky/2] + Cos[ky])^2 + 
4 t1^2 (Cos[(Sqrt[3] kx)/2] - Cos[ky/2])^2 Sin[ky/
2]^2 + (Δ + 4 t2 Cos[(3 ky)/2] Sin[(Sqrt[3] kx)/2] Sin[ϕ] - 
2 t2 Sin[Sqrt[3] kx] Sin[\[Phi]])^2]]]

the result will still have Conjugate intact. And it shouldn't be like this. It should be smart enough to recognize that the expression under the sqrt is absolutely greater than or equal to zero and throw out the Conjugate.

Rojo mentioned "MapAll" , But "MapAll" can do nothing more in this situation.

And Nasser M. Abbasi proposed to ComplexExpand. Yes, ComplexExpand can tackle this expression. But let me point out the difficulty encountered in real case.

In real case, there will be very large expression(even several pages long). And directly ComplexExpand such large expression will cost considerable cpu time (I have tried), because it will transform many expression into Re and Im form which I do not expect. So the most efficient way is still simplify directly first. But as I have showed, there will be several "Conjugate" so obstinate and these Conjugate hides in such long expressions which are difficult to find. I have to find them term by term and ComplexExpand them to test if they are really real. And this is so inconvenient!

I hope some one helps me out.

$\endgroup$
2
  • 1
    $\begingroup$ See also this question for more about taking complex conjugates when variables can be assumed to be real. $\endgroup$ Sep 27, 2017 at 19:12
  • 1
    $\begingroup$ @JessRiedel Thank you so much $\endgroup$
    – matheorem
    Sep 28, 2017 at 11:54

2 Answers 2

7
$\begingroup$

When I wrote

Clear["Global`*"]
Simplify[-Conjugate[o + Sqrt[e^2 - 2 e o + o^2 + q^2 + w^2]] -Conjugate[e]]
(* -e - Conjugate[o + Sqrt[e^2 - 2*e*o + o^2 + q^2 + w^2]] *)

then simply removed the minus sign

Simplify[Conjugate[o + Sqrt[e^2 - 2 e o + o^2 + q^2 + w^2]] - Conjugate[e]]
(*-e + o + Sqrt[e^2 - 2*e*o + o^2 + q^2 + w^2]*)

This told me I need to ComplexExpand . And no need for assumptions. Put back the minus sign, and now I get what you expected to see

Simplify[ComplexExpand[-Conjugate[o + Sqrt[e^2 - 2*e*o + o^2 + q^2 + w^2]]-Conjugate[e]]]
(* -e-o-Sqrt[e^2-2 e o+o^2+q^2+w^2] *)

so use ComplexExpand

Now your example can be written as

Clear["Global`*"]
σ[i_] := PauliMatrix[i];
m := Sum[a[i]*σ[i], {i, 1, 3}];
a[1] := q;
a[2] := w;
a[3] := e - o;
sol = Conjugate[Eigenvectors[m]];
Simplify[ComplexExpand[sol]]

which gives

enter image description here

$\endgroup$
5
$\begingroup$

It can't be a bug since the result is not wrong. It simply isn't as simplified as you would have wished, and that is very often the case.

This time, Simplify doesn't seem to be trying enough transformations. Try with FullSimplify

Conjugate[Eigenvectors[m]] // FullSimplify

{{-((-e + o + Sqrt[(e - o)^2 + q^2 + w^2])/(q - I w)), 1}, {( e - o + Sqrt[(e - o)^2 + q^2 + w^2])/(q - I w), 1}}

Simplify clearly knows to remove that Conjugate. But, for some reason, it doesn't reach deep enough in your expresion, or try hard enough, to make this simplification.

Given this, another alternative to fix it is to make sure Simplify reaches way down your expression, using MapAll

Simplify //@ Conjugate[Eigenvectors[m]]

{{-((-e + o + Sqrt[e^2 - 2 e o + o^2 + q^2 + w^2])/(q - I w)), 1}, {( e - o + Sqrt[e^2 - 2 e o + o^2 + q^2 + w^2])/(q - I w), 1}}

$\endgroup$
1
  • 1
    $\begingroup$ By the way, I don't have a clear idea of how much time the MapAll solution takes for a big expression, but it probably wastes a lot too. If your assumptions are those, you probably should go with ComplexExpand with a simple Simplify afterwards $\endgroup$
    – Rojo
    Dec 8, 2012 at 6:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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