nameerror:name 'array' is not defined
Question: I copy-pasted this program in pyscripter 2.7. I downloaded numpy and scipy for
python 2.7 too.

    
    
    import numpy as np
    from scipy import linalg
    A = np.array([[1,2],[3,4]])
    array([[1, 2],
          [3, 4]])
    linalg.inv(A)
    array([[-2. ,  1. ],
          [ 1.5, -0.5]])
    A.dot(linalg.inv(A)) #double check
    array([[  1.00000000e+00,   0.00000000e+00],
          [  4.44089210e-16,   1.00000000e+00]])
    

but it doesn't be run and is see this: `Name Error: name 'array' is not
defined`. what should I do?


Answer: You seem to have attached the output in the script you are trying to run,
hence the error. Executing the following gives a similar error -

    
    
    >>> array([1, 2])
    
    Traceback (most recent call last):
      File "<pyshell#18>", line 1, in <module>
        array([1, 2])
    NameError: name 'array' is not defined
    

And this matches your script.

    
    
    >>> A = np.array([[1, 2], [3, 4]])
    >>> A
    array([[1, 2],
           [3, 4]])
    

Your original script is.

    
    
    import numpy as np
    from scipy import linalg
    A = np.array([[1,2],[3,4]])
    linalg.inv(A)
    A.dot(linalg.inv(A)) #double check
    

