[Tutor] Help....

Alan Gauld alan.gauld at yahoo.co.uk
Thu Aug 17 12:54:36 EDT 2017


On 17/08/17 14:17, edmundo pierre via Tutor wrote:
> I am trying to write a code to solve a system of equation at 2 variables. 

> I used Tkinter to do it. 

More significantly you used numpy to do it and that seems
to be where the issues lie, not in Tkinter.

Numpy is part of SciPy which has a dedicated support forum

> I disigned everything, but I am just stocked when it> comes to display the answer on the screen.

I'm not sure how you are using Tkinter here because you didn't
send any code but looking at the traceback your code is
getting called by Tkinter somehow.

That aside, the real issue seems to be here:

> File "C:\Users\edwin\AppData\Local\Programs\Python\Python36-32\ed.py", 
> line 122, in Calculate    
> z = np.linalg.solve ( a, b)  

> File "C:\Users\edwin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\linalg\linalg.py", 
> line 90, in _raise_linalgerror_singular    
> raise LinAlgError("Singular matrix") numpy.linalg.linalg.LinAlgError: Singular matrix

I have no idea how the numpy stuff works but it looks like a data error,
maybe you are passing the wrong type?

But we'd need to see where 'a' and 'b' come from to be sure.

BTW its probably a bad idea to put your code (ed.py) inside the Python
folder structure, better to have a separate work space for your own
files. Especially if you install another version of Python and
want your code to work with it too.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list