Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Im trying to solve a matrix where: a= [[2 0], [0 2], [1 1]] b= [[0], [0], [0]] I am using numpy to solve this

image text in transcribed

Im trying to solve a matrix where:

a= [[2 0], [0 2], [1 1]]

b= [[0], [0], [0]]

I am using numpy to solve this matrix. The matrix is supposed to balance a chemical equation in this has it is H2 + O2 ---> H2O

Traceback (most recent call last): File "/Users/parsa/Desktop/A2/Reactiont.py", line 152, in bal = balance(lhsList, rhsList), File "/Users/parsa/Desktop/A2/Reactiont.py", line 108, in balance x = lin.solve(a,b) File "<_array_function_ internals>", line 6, in solve File "/usr/local/Cellar/python/3.7.3/Frameworks/Python. framework/Versions/3.77 lib/python3.7 site-packagesumpy _assert_stacked_square(a) File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packagesumpy/ raise LinAlgError('Last 2 dimensions of the array must be square'), numpy. linalg.LinAlgError: Last 2 dimensions of the array must be square Traceback (most recent call last): File "/Users/parsa/Desktop/A2/Reactiont.py", line 152, in bal = balance(lhsList, rhsList), File "/Users/parsa/Desktop/A2/Reactiont.py", line 108, in balance x = lin.solve(a,b) File "<_array_function_ internals>", line 6, in solve File "/usr/local/Cellar/python/3.7.3/Frameworks/Python. framework/Versions/3.77 lib/python3.7 site-packagesumpy _assert_stacked_square(a) File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packagesumpy/ raise LinAlgError('Last 2 dimensions of the array must be square'), numpy. linalg.LinAlgError: Last 2 dimensions of the array must be square

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions