Hello I have a problem using Scipy's fsolve
function when I have an equation system.
My code only let's me have as much variables as there are equations in my system, but we all know that in practice, you can have more equations than variables, especially when the solution is not a concrete number but a range of numbers, an additional equation can help narrow down the "haystack" so to speak.
How to insert more equations than variables is my question?
Suppose I have the following non-linear system:
A/B=0.4583(3)
A/C=0.25
A/D=0.72(2)
B/C=0.54(54)
So I have the following code for this:
from scipy.optimize import *
from numpy import *
def FUNC(arg):
A,B,C,D=arg
UNK=empty((4))
UNK[0]= A/B-0.458333333333333
UNK[1]= A/C-0.25
UNK[2]= A/D-0.722222222222222
UNK[3]= B/C-0.545454545454546
return UNK
SOLVED= fsolve(FUNC, [1.0]*4)
print (SOLVED)
The problem is that I also know the following information:
B/D=1.57(57)
C/D=2.8(8)
How can I insert these 2 additional equations into my equation system?
Also how can I display the range of solutions instead of just 1 solution, it seems like fsolve
only displays the 1st solution it encounters, not the entire range of possible solutions.