[SciPy-User] scipy.optimize leastsq with numpy longdouble?

Charles R Harris charlesr.harris at gmail.com
Wed Nov 17 14:21:57 EST 2010


On Wed, Nov 17, 2010 at 10:49 AM, <josef.pktd at gmail.com> wrote:

> On Wed, Nov 17, 2010 at 12:25 PM, Joan Smith <joans at mit.edu> wrote:
> > Hi,
> > What do you mean where is the data coming from? It's from an experiment..
> > function I'm fitting is:
> > maxwell_boltzmann = lambda v,x:
> > v[0]*(x-C0)**(-4)*np.exp(-(L/v[1])**2*(x-C0)**(-2)) + v[2]
> > and the data is in an array of longdoubles.
>
> I don't know if any of the optimization routines can handle
> long-double, maybe one of the pure python optimizers is less picky
> about the type.
>
> some guesses:
> Maybe taking exp(log(...)) of the first part increases the numerical
> precision of the calculation enough to get results, or maybe a two
> step method with v[2] estimated in an outer optimization and log in
> the inner loop.
>
> (statsmodels doesn't have anything that would help, as far as I can see)
>
>
It can also be reduced to a one variable problem in v[1] for leastsq since
given that variable the problem reduces to linear least squares which can be
done inside the called function.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20101117/0b75612a/attachment.html>


More information about the SciPy-User mailing list