So I'm trying to solve a nonlinear system of 6 equations 6 unknowns using fsolve. I followed a format found here:
http://folk.uio.no/inf3330/scripting/doc/python/SciPy/tutorial/old/node18.html
My system of equations:
def func(x):
out = [x[0] - c*(t1 - x[3])]
out.append(x[1] - c*(t2 - x[3]))
out.append(x[2] - c*(t3 - x[3]))
out.append(x[0]**2 - (right_x - x[4])**2 - (right_y - x[5])**2)
out.append(x[1]**2 - (middle_x - x[4])**2 - (middle_y - y[5])**2)
out.append(x[2]**2 - (left_x - x[4])**2 - (left_y - x[5])**2)
return out
solve = fsolve(func, [1.0, 1.0, 1.0, 1.5, 1.0, 1.0])
print(solve)
returns the error:
File "C:\Anaconda3\lib\site-packages\numpy\core\numeric.py", line 525, in asanyarray
return array(a, dtype, copy=False, order=order, subok=True)
ValueError: setting an array element with a sequence.
All constants are of dtype: float
Any ideas on what I'm doing wrong?
The one thing I can spot is that the y[5] here looks like a typo:
out.append(x[1]**2 - (middle_x - x[4])**2 - (middle_y - y[5])**2)
might y[5] in your context be something like a numpy array or similar?