0
$\begingroup$

I'm trying to get the real part of a expression, but I failed. It looks like this.

the first image

Does anyone have a solution?

By the way, it is quite weird because when I simplify this:

the second image

Mathematica returns the right answer, but I can't tell the big difference between the two expressions.

Here is my code:

vectorVr = Array[Subscript[vr, #] &, 9];
vectorVi = Array[Subscript[vi, #] &, 9];
$Assumptions = Join[vectorVr, vectorVi] ∈ Reals;

FullSimplify[
  (0.` + 0.0576` I) 
    (I Subscript[vi, 1] - I Subscript[vi, 4] + Subscript[vr, 1] - Subscript[vr, 4]) (-I Subscript[vi, 1] + I Subscript[vi, 4] + Subscript[vr, 1] - Subscript[vr, 4]) 
  // Expand // Re]
$\endgroup$
2
$\begingroup$

Use ComplexExpand

vectorVr = Array[Subscript[vr, #] &, 9];
vectorVi = Array[Subscript[vi, #] &, 9];
$Assumptions = Join[vectorVr, vectorVi] \[Element] Reals;

(0.` + 0.0576` I) (I Subscript[vi, 1] - I Subscript[vi, 4] + 
      Subscript[vr, 1] - Subscript[vr, 4]) (-I Subscript[vi, 1] + 
      I Subscript[vi, 4] + Subscript[vr, 1] - Subscript[vr, 4]) // 
   ComplexExpand // Re // Simplify

(*  0  *)
$\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.