>>> def f(x): ... return x[0]*14.80461 + x[1]*(-4.9233) + x[2]*(10*0.4803) >>> def vf(x): ... return [f(x), 0, 0] >> xx = fsolve(vf, x0=[0,0,1]) >>> >>> f(xx) 8.8817841970012523e-16
Since the solution is not unique, different initial values ββfor the unknown lead to different (valid) solutions.
EDIT: Why does this work. Well, this is a dirty hack. It is simply that fsolve and his relatives deal with systems of equations. What I did here, I defined a system of three equations ( f(x) returns a list of three elements) for three variables ( x has three elements). Now fsolve uses a Newton type algorithm to converge to a solution.
Itβs clear that the system is underdetermined: you can specify arbitrary values ββof two variables, for example x[1] and x[2] , and find x[0] to satisfy the only nontrivial equation that you have. You can clearly see this by specifying a couple of initial guesses for x0 and see different outputs, all of which satisfy f(x)=0 up to a certain tolerance.
ev-br source share