Hi Pierre, you are correct - the methods that simply refuse negative results will not be sufficient.
The code I have so far is attached as *.py files. Thanks, Matt Be aware that I have adusted _lsq2.py so that it can be shown to the world - it still contains a basic outline of what should be done but it may not look too efficient. >===== Original Message From Pierre Barbier de Reuille <[EMAIL PROTECTED]> ===== >Alan Gauld a �crit : >>>I am trying to use a least squares method (the one written by Konrad >> >> Hinsen), >> >>>but I do not want the method to be able to generate negative values. >> >> Is there >> >>>a way to stop least squares programs from doing so? >> >> >> def _leastSquare(): >> # do the thing that might generate negatives >> >> def leastSquare(): >> firstTry = _leastSquare() >> if firstTry < 0: >> return leastSquare() # try again >> else: >> return firstTry >> >> Primitive but it works. If you want more a efficient/elegant solution >> show us what you have... > >How is this suppose to work ? Most of the least square algorithm find >the nearest local minimum of the distance function. So, if you call many >times the least square function without changing the initial values it >will do absolutely nothing ! Or what do you suppose for your least >square method ? > >> >> Alan G. >> >> _______________________________________________ >> Tutor maillist - [email protected] >> http://mail.python.org/mailman/listinfo/tutor >> > >-- >Pierre Barbier de Reuille > >INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP >Botanique et Bio-informatique de l'Architecture des Plantes >TA40/PSII, Boulevard de la Lironde >34398 MONTPELLIER CEDEX 5, France > >tel : (33) 4 67 61 65 77 fax : (33) 4 67 61 56 68 > >_______________________________________________ >Tutor maillist - [email protected] >http://mail.python.org/mailman/listinfo/tutor
_lsq2.py
Description: Binary data
LeastSquares.py
Description: Binary data
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
