commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kurt Pernstich <kurt.pernst...@gmail.com>
Subject [math] PolynomialFitter.fit() stalls
Date Thu, 31 May 2012 14:55:02 GMT
Hi, in certain cases I ran into the problem that the PolynomialFitter.fit()
method stalls, meaning that it does not return, nor throw an Exception. Is
there a way to tell the PolynomialFitter to iterate only N-times to ensure
that my program does not stall?

Maybe I should note that when I used a LevenbergMarquardOptimizer instead
of a GaussNewtonOptimizer the fit worked fine for the limited number of
test cases considered, but this is not a guarantee that the
LevenbergMarquardOptimizer will work for all cases.

Here is a test case that stalls the PolynomialFitter.fit() on my machine:

PolynomialFitter RshuntFitter = new PolynomialFitter(1, new
GaussNewtonOptimizer());
RshuntFitter.addObservedPoint(-0.2, -7.12442E-13);
RshuntFitter.addObservedPoint(-0.199, -4.33397E-13);
RshuntFitter.addObservedPoint(-0.198, -2.823E-13);
RshuntFitter.addObservedPoint(-0.197, -1.40405E-13);
RshuntFitter.addObservedPoint(-0.196, -7.80821E-15);
RshuntFitter.addObservedPoint(-0.195, 6.20484E-14);
RshuntFitter.addObservedPoint(-0.194, 7.24673E-14);
RshuntFitter.addObservedPoint(-0.193, 1.47152E-13);
RshuntFitter.addObservedPoint(-0.192, 1.9629E-13);
RshuntFitter.addObservedPoint(-0.191, 2.12038E-13);
RshuntFitter.addObservedPoint(-0.19, 2.46906E-13);
RshuntFitter.addObservedPoint(-0.189, 2.77495E-13);
RshuntFitter.addObservedPoint(-0.188, 2.51281E-13);
RshuntFitter.addObservedPoint(-0.187, 2.64001E-13);
RshuntFitter.addObservedPoint(-0.186, 2.8882E-13);
RshuntFitter.addObservedPoint(-0.185, 3.13604E-13);
RshuntFitter.addObservedPoint(-0.184, 3.14248E-13);
RshuntFitter.addObservedPoint(-0.183, 3.1172E-13);
RshuntFitter.addObservedPoint(-0.182, 3.12912E-13);
RshuntFitter.addObservedPoint(-0.181, 3.06761E-13);
RshuntFitter.addObservedPoint(-0.18, 2.8559E-13);
RshuntFitter.addObservedPoint(-0.179, 2.86806E-13);
RshuntFitter.addObservedPoint(-0.178, 2.985E-13);
RshuntFitter.addObservedPoint(-0.177, 2.67148E-13);
RshuntFitter.addObservedPoint(-0.176, 2.94173E-13);
RshuntFitter.addObservedPoint(-0.175, 3.27528E-13);
RshuntFitter.addObservedPoint(-0.174, 3.33858E-13);
RshuntFitter.addObservedPoint(-0.173, 2.97511E-13);
RshuntFitter.addObservedPoint(-0.172, 2.8615E-13);
RshuntFitter.addObservedPoint(-0.171, 2.84624E-13);
PolynomialFunction RshuntFit = new PolynomialFunction(RshuntFitter.fit());

Thanks for your help,
Kurt

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message