Advertisement
furas

Python - numpy - complex

May 13th, 2017
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1. from __future__ import print_function
  2. import numpy as np
  3.  
  4. Z = np.array([
  5.     [(0.006807721430203688, -81.46897205040608), (0.003415323421254521, 28.39278436997311)],
  6.     [(0.005655394562415266, -3.9653893889864045), (0.0012579228508627063, -0.004793001022412831)],
  7.     [(0.0011839417577218592, 0.003367610034685792),(0.0009527970980828063, 0.009237864349152691)]
  8. ])
  9.  
  10. C = Z[:,:,0] + 1j * Z[:,:,1]
  11.  
  12. # ---------------------------------------------
  13.  
  14. print('\n--- Z[:,:,0] ---\n')
  15.  
  16. print( Z[:,:,0] )
  17.  
  18. # ---------------------------------------------
  19.  
  20. print('\n--- Z[:,:,0] + 1j * Z[:,:,1] ---\n')
  21.  
  22. print(C)
  23.  
  24. # ---------------------------------------------
  25.  
  26. print('\n--- np.real(C) ---\n')
  27.  
  28. print(np.real(C))
  29.  
  30. # ---------------------------------------------
  31.  
  32. '''
  33. --- Z[:,:,0] ---
  34.  
  35. [[ 0.00680772  0.00341532]
  36. [ 0.00565539  0.00125792]
  37. [ 0.00118394  0.0009528 ]]
  38.  
  39. --- Z[:,:,0] + 1j * Z[:,:,1] ---
  40.  
  41. [[ 0.00680772 -8.14689721e+01j  0.00341532 +2.83927844e+01j]
  42. [ 0.00565539 -3.96538939e+00j  0.00125792 -4.79300102e-03j]
  43. [ 0.00118394 +3.36761003e-03j  0.00095280 +9.23786435e-03j]]
  44.  
  45. --- np.real(C) ---
  46.  
  47. [[ 0.00680772  0.00341532]
  48. [ 0.00565539  0.00125792]
  49. [ 0.00118394  0.0009528 ]]
  50. '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement