0
$\begingroup$

For my system of equations, the procedure described in Solving complex equations of using Reduce works no more. How can I separate the real and imaginary part of the equations? Because then I could use Solve[equations, vars, Reals]. Nevertheless I hope for a simpler way to overcome this issue.

Example

Vector = {v1, v2, v3, v4};
Matrix = {{c11, c12, c13, c14}, 
          {c21, c22, c23, c24}, 
          {c31, c32, c33, c34}, 
          {c41, c42, c43, c44}};
Reduce[Table[0 == Sum[Matrix[[r, k]] Vector[[k]], {k, 4}], {r, 4}] && 
 Element[{v1Real, v1Complex, v2Real, v2Complex, v3Real, v3Complex, v4Real, v4Complex}, Reals],
 {v1Real, v1Complex, v2Real, v2Complex, v3Real, v3Complex, v4Real, v4Complex}] /. 
 {v1 -> v1Real + I v1Complex, v2 -> v2Real + I v2Complex, v3 -> v3Real + I v3Complex, v4 -> v4Real + I v4Complex}
$\endgroup$
4
  • $\begingroup$ We could likely provide something more useful to you if on;y you'd explicitly mention what your "system of equations" are. $\endgroup$ May 2, 2013 at 12:05
  • 1
    $\begingroup$ The way you defined the equations you can only expect trivial solutions. Try to check eq = (# == 0) & /@ (matrix . vector);Solve[eq, vector, Complexes]. Also be careful with the fact that initiating symbols with capital letters are avoided in Mathematica. $\endgroup$ May 2, 2013 at 12:41
  • $\begingroup$ I want to introduce some symmetry properties into the vector as in my case the vector represents the density matrix, i.e. Complexes is no intuitive option! $\endgroup$
    – strpeter
    May 2, 2013 at 14:10
  • 3
    $\begingroup$ It's a linear system. You can use LinearSolve. Then, if you must, separate the symbolic solution into real and imaginary parts using Re and Im. $\endgroup$ May 2, 2013 at 14:44

1 Answer 1

3
$\begingroup$

Daniel Lichtblau mentions in a comment:

It's a linear system. You can use LinearSolve. Then, if you must, separate the symbolic solution into real and imaginary parts using Re and Im.

$\endgroup$
6
  • $\begingroup$ If you want to get credit for this answer, could you please write out the corresponding code? ;) Thank you! $\endgroup$
    – strpeter
    Sep 27, 2015 at 16:24
  • $\begingroup$ I am not looking for credit; I only posted this to get the question off the unanswered list, and the answer is already marked as "community wiki", which means no points accrue to the poster. Is it really helpful for you if I add "Through@{Re, Im}@LinearSolve[Matrix, Vector]" to the above or was the comment clear enough already? I think probably the latter. $\endgroup$ Sep 27, 2015 at 16:36
  • $\begingroup$ I agree with you since I did not want to bother you. $\endgroup$
    – strpeter
    Sep 27, 2015 at 16:56
  • $\begingroup$ @strpeter if this answer doesn't meet your needs then please clarify the question and perhaps you can get a better one. There is nothing wrong with saying that an answer doesn't help, if that's the case--it just seemed to me that Daniel's comment was all that was needed to address it, but maybe I misunderstood. $\endgroup$ Sep 27, 2015 at 17:01
  • 1
    $\begingroup$ @strpeter good--glad to hear that it is a useful answer. To write it out without using @, we have Through[{Re, Im}[LinearSolve[Matrix, Vector]]]. The @ is right-associative and simply takes the place of the function application brackets. I usually write Through this way as I find it easier to read than the infix form. $\endgroup$ Sep 27, 2015 at 17:46

Your Answer

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

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