I am trying to solve a system of equations that has 3 variables and a variable number of equations.
Basically, the system is between 5 and 12 equations long, and regardless of how many equations there are, I am trying to solve for 3 variables.
It looks like this:
(x-A)**2 + (y-B)**2 + (z-C)**2 = (c(t-d))**2
I know A,B,C, and the whole right side. A,B,C and the right side are all arrays of length n, where n varies randomly between 5 and 12. So then we have a system of equations that changes in size. I believe I need to use numpy's lstsq function and do something like:
data,data1 = getData() # I will have to do this for 2 unique systems.
A = data[:,0]
B = data[:,1]
C = data[:,2]
tid = data[:,3]
P = (x-A)**2 + (y-B)**2 + (z-C)**2
b = tid
solved = lstsq(P,b)
print solved
This however doesn't work, as we know that x,y,z are implicit, and therefore need to be taken out of P in order for this to work. Help!