-1
$\begingroup$

I have a 2 by 2 matrix T: {{x, y}, {-y, x}} where x is the real part of some complex number and y is the imaginary part of something complex number. Let's say z1 = 1 + i2. How would I do T[z1] where x would be 1 and y would be 2?

$\endgroup$
  • 2
    $\begingroup$ Try {#, Cross[#]} &@ReIm[1 + 2 I] or {IdentityMatrix[2], -LeviCivitaTensor[2]}.ReIm[1 + 2 I] and report back. $\endgroup$ – J. M. will be back soon Apr 12 '16 at 17:15
  • 1
    $\begingroup$ T[z_] = {{Re[z], Im[z]}, {-Im[z], Re[z]}}; z1 = 1 + 2 I; T[z1] evaluates to {{1, 2}, {-2, 1}} $\endgroup$ – Bob Hanlon Apr 12 '16 at 19:17
1
$\begingroup$

The comments provide very nice answers. Perhaps you wish the 2 x 2 analogs of 1 and I:

r = IdentityMatrix[2];
i = {{0, -1}, {1, 0}};
fun[z_] := {r, i}.ReIm[z]

Note i.i yields {{-1,0},{0,-1}}= -IdentityMatrix[2].

Look at the comments as they show very nice ways of achieving this.

$\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.