[SciPy-User] scipy.optimize leastsq with numpy longdouble?
Charles R Harris
Wed Nov 17 13:21:57 CST 2010
On Wed, Nov 17, 2010 at 10:49 AM, <email@example.com> wrote:
> On Wed, Nov 17, 2010 at 12:25 PM, Joan Smith <firstname.lastname@example.org> 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*(x-C0)**(-4)*np.exp(-(L/v)**2*(x-C0)**(-2)) + v
> > 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 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 for leastsq since
given that variable the problem reduces to linear least squares which can be
done inside the called function.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User