Message Boards Message Boards

0
|
475 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Map function not fully evaluating my matrix

Posted 3 months ago

I'm currently trying to separate a matrix of complex numbers in a new matrix that only has the real part of each number with the following code:

G = Map[Real, Y, {2}]

But I get the following output

{{Real[4.21223 - 11.4944 I], Real[-2.20588 + 3.67647 I], Real[0], 
  Real[-1.17647 + 4.70588 I], Real[-0.829876 + 3.11203 I], 
  Real[0]}, {Real[-2.20588 + 3.67647 I], Real[9.9847 - 22.6166 I], 
  Real[-0.907716 + 3.78215 I], Real[-4. + 8. I], Real[-1. + 3. I], 
  Real[-1.8711 + 4.158 I]}, {Real[0], Real[-0.907716 + 3.78215 I], 
  Real[5.32668 - 16.2898 I], Real[0], Real[-1.66667 + 3.33333 I], 
  Real[-2.75229 + 9.17431 I]}, {Real[-1.17647 + 4.70588 I], 
  Real[-4. + 8. I], Real[0], Real[6.17647 - 14.7059 I], 
  Real[-1. + 2. I], Real[0]}, {Real[-0.829876 + 3.11203 I], 
  Real[-1. + 3. I], Real[-1.66667 + 3.33333 I], Real[-1. + 2. I], 
  Real[5.77391 - 14.1826 I], Real[-1.27737 + 2.73723 I]}, {Real[0], 
  Real[-1.8711 + 4.158 I], Real[-2.75229 + 9.17431 I], Real[0], 
  Real[-1.27737 + 2.73723 I], Real[5.90077 - 16.0695 I]}}

What should I do to fully evaluate the exprassion?

2 Replies
Posted 3 months ago

The symbol Real is used as a head to represent real numbers. The function that takes complex numbers to real numbers is Re. So, use Map with Re instead of Real.

POSTED BY: Eric Rimbey

Re[Y] should do it without Map[], since Re has the attribute Listable.

POSTED BY: Michael Rogers
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract