title: How to work out ''ComplexWarning: Casting complex values to real discards the imaginary part''?
body: <p>I would like to use a matrix with complex entries to construct a new matrix, but it gives me the warning </p>
  
  <blockquote>
    <p>"ComplexWarning: Casting complex values to real discards the imaginary part".</p>
  </blockquote>
  
  <p>As a result, the new matrix's entries are all real numbers. How to make all the entries keep their imaginary part?</p>
  
  <p>This is the image containing my original code</p>
  
  <p><img src="https://i.stack.imgur.com/P1Nph.jpg" alt="This is the image containing my original code"></p>