[Tutor] least squares
mdcooper at uvic.ca
Thu Dec 16 23:23:57 CET 2004
Thanks for the reply - I was purposely vague just to see what people would ask
The code uses LinearAlgebra.py from Numeric and LeastSquares.py from
I am trying to get a corrolation between a large number of variables and for
many similar equations :
(Ca1 * xa^2) + (Ca2 * ya^2) + (Ca3 * za^2) + ... = ta
(Cb1 * xb^2) + (Cb2 * yb^2) + (Cb3 * zb^2) + ... = tb
which is solved to get:
(C1 * x^2) + (C2 * y^2) + (C3 * z^2) + ... = t
where the submitted values of x,y, and z should give the correct t
and I am using the code to get C1, C2, C3, .... These constants are not
allowed to be negative and the submitted equations are such that there is no
reason for the values to be negative, and although a good fit may allow them
to be negative, another good fit will be found if they are all positive.
I need them to be all positive but also all to exist, so filtering out the
negative numbers is not sufficient.
>===== Original Message From Danny Yoo <dyoo at hkn.eecs.berkeley.edu> =====
>On Thu, 16 Dec 2004, mdcooper wrote:
>> I am trying to run a least squares program (written by Konrad Hinsen)
>You're assuming that we know who Konrad Hinsen is. *grin* Ok, when you're
>referring to the least-squared code, are you referring to a module in
>Please point us to the code that you're running, and we can give better
>help. Most of us are just learning Python, so many of us may not really
>be familiar with the tools that you are using. Make it easier for us to
>help you! *grin*
>> but I would like to only have positive values returned. Can anyone help
>> is altering the code to do this?
>This shouldn't be too bad: it sounds like a filtering of the return value
>is what you're looking for. Show us a concrete example of what you're
>getting so far, and what you want to get.
>Good luck to you.
More information about the Tutor