471,313 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,313 software developers and data experts.

Numpy , matrix inverse & multiply crashes python

75
Hi! I have problem with numpy, multiplying with an inversed matrix will crash python :(


this works fine:
Expand|Select|Wrap|Line Numbers
  1. from numpy import matrix
  2.  
  3. A = matrix([[3,4],[5,2]])
  4. B = matrix([[11],[9]])
  5. print A.I   #inverse matrix
  6. print A*B
  7.  
but this will crash python:
Expand|Select|Wrap|Line Numbers
  1. A.I * B
  2.  
(using win xp)
Jan 10 '08 #1
1 14868
bvdet
2,851 Expert Mod 2GB
Hi! I have problem with numpy, multiplying with an inversed matrix will crash python :(


this works fine:
Expand|Select|Wrap|Line Numbers
  1. from numpy import matrix
  2.  
  3. A = matrix([[3,4],[5,2]])
  4. B = matrix([[11],[9]])
  5. print A.I   #inverse matrix
  6. print A*B
  7.  
but this will crash python:
Expand|Select|Wrap|Line Numbers
  1. A.I * B
  2.  
(using win xp)
I am in Python 2.3, also XP.
Expand|Select|Wrap|Line Numbers
  1. >>> import numpy
  2. >>> A = numpy.matrix([[3,4],[5,2]])
  3. >>> B = numpy.matrix([[11],[9]])
  4. >>> A.I
  5. matrix([[-0.14285714,  0.28571429],
  6.         [ 0.35714286, -0.21428571]])
  7. >>> B
  8. matrix([[11],
  9.         [ 9]])
  10. >>> A*B
  11. matrix([[69],
  12.         [73]])
  13. >>> A.I*B
  14. matrix([[ 1.],
  15.         [ 2.]])
  16. >>> 
Jan 10 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by vishnu mahendra | last post: by
1 post views Thread by drife | last post: by
2 posts views Thread by Chris Smith | last post: by
1 post views Thread by Jianzhong Liu | last post: by
1 post views Thread by Michael O'Brien | last post: by
6 posts views Thread by lancered | last post: by
reply views Thread by DarrenWeber | last post: by
3 posts views Thread by aaram81 | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.