> 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...

Alan G.

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to