Hi Jeremy:
Thank you for my catching my error in the description. I wrote this
code a while ago and didn't remember what i did exactly. I went back
to the code and this is what i have:
(x[j-1] is the previous valid value)
if lower_bound is not None and new_x < lower_bound:
distance = math.sqrt(abs(x[j-1] - new_x))
new_x = (lower_bound + x[j-1])/distance
elif upper_bound is not None and new_x > upper_bound:
distance = math.sqrt(abs(new_x - x[j-1]))
new_x = (upper_bound - x[j-1])/distance
And now that I think about it, I am not sure this is "direction-
preserving" in the sense of the function gradient. I don't have that
much experience in the numerical solving field, so this was my best
guess at the time I wrote the code. I've only tested the lower-bound
(mostly for non-negative). I see now that my upper bound code could
violate the lower bound. I will try and work in your suggestions into
the code.
Thanks,
Kiran
On Aug 27, 10:22 am, "Dudley, Jeremy" <
jeremy.dud...@wrcplc.co.uk>
wrote:
> The source is actually already available:
http://www.netlib.org/minpack. The code of interest is hybrd and hybrdj. It's in fortran and should be quite easy to link with ASCEND. The bounds support is the only part you have to add to the code. My code is all in Python (Google App Engine does not allow anything but Python or Java).
> > visithttp://
www.wrcplc.co.uk/default.aspx?item=835-Keeping our
> > clients up-to-date with WRc's business developments
> > ----------------------------------------------------------------------
> > --------------------- Visit our
> >
websiteswww.wrcplc.co.ukandwww.wrcnsf.com, as well aswww.waterportfolio.comforcollaborative research projects.
> > ----------------------------------------------------------------------
> > --------------------- The Information in this e-mail is confidential
> > and is intended solely for the addressee. Access to this e-mail by any other party is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on the information contained in this e-mail is prohibited and maybe unlawful. When addressed to WRc Clients, any opinions or advice contained in this e-mail are subject to the terms and conditions expressed in the governing WRc Client Agreement.
> > ----------------------------------------------------------------------
> > --------------------- WRc plc is a company registered in England and
> > Wales. Registered office address: Frankland Road, Blagrove, Swindon, Wiltshire SN5 8YF. Company registration number 2262098. VAT number 527 1804 53.
> > ----------------------------------------------------------------------
> > ---------------------
>
> -------------------------------------------------------------------------------------------