I have 3 equations
-950 X = B1
-550 X = B2
-250 X = B3
B1, B2, B3 are known values 3D arrays
X should be also a 3D array
My code is
A = np.array([-950],[-550],[-250])
B = np.array([np.log(b1000_data/b50_data), np.log(b600_data/b50_data), np.log(b300_data/b50_data)])
X = np.linalg.solve(A,B)
However, it fails
A = np.array([-950],[-550],[-250]) ValueError: only 2 non-keyword arguments accepted
First you should be doing like:
a = np.array([[-950], [-550],[-250]])
Given your equation Ax=B
. In this case you have more equations than required. This results in many possible x
values. In this case 3
. It will result into error.
Read here: https://andreask.cs.illinois.edu/cs357-s15/public/demos/06-qr-applications/Solving%20Least-Squares%20Problems.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.