Solve a potentially over-determined system with uncertainty in
the values.
wsolve uses the singular value decomposition for increased accuracy.
Estimates the uncertainty for the solution from the scatter in the data.
Example
Weighted system:
import numpy,wsolve
A = numpy.matrix("1,2,3;2,1,3;1,1,1",'d').A
xin = numpy.array([1,2,3],'d')
dy = numpy.array([0.2,0.01,0.1])
y = numpy.random.normal(numpy.dot(A,xin),dy)
print A,y,dy
s = wsolve.wsolve(A,y,dy)
print "xin,x,dx", xin, s.x, s.std
Note there is a counter-intuitive result that scaling the estimated
uncertainty in the data does not affect the computed uncertainty in
the fit. This is the correct result --- if the data were indeed
selected from a process with ten times the uncertainty, you would
expect the scatter in the data to increase by a factor of ten as
well. When this new data set is fitted, it will show a computed
uncertainty increased by the same factor. Monte carlo simulations
bear this out. The conclusion is that the dataset carries its own
information about the variance in the data, and the weight vector
serves only to provide relative weighting between the points.