forum.alglib.net
http://forum.alglib.net/

polynomialfit bug?
http://forum.alglib.net/viewtopic.php?f=2&t=135
Page 1 of 1

Author:  rbryce [ Mon Dec 06, 2010 7:31 pm ]
Post subject:  polynomialfit bug?

Hi all,

Great work on this code. However, I'm trying to use alglib.polynomialfit and I'm having difficulties.

Generally, it works very well. However, on some datasets, I have some issues. Some insight/help would be appreciated. I'm using C#.

I call it something like:

alglib.polynomialfitreport rr;
double [] tm; // array of double's representing time - not equal intervals but sorted in increasing order
double [] xa; // array of values representing 'x' (with error) at time tm[]
int poly_degree; // always 2 or 3 or 4
int info;
alglib.barycentricinterpolant xb;
alglib.polynomialfit(tm, xa, polydegree, out info, out xb, out rr);

When I then want to generate data, I'm calling:
alglib.barycentricdiff1(xb, t, out x, out slope);

Pretty standard stuff, I think. But occasionally, depending on parameter t, x will calculate to NaN, even though when you look at the dataset (via a grapher), it's a pretty simple curve between tm and xa that can easily be approximated with a 2 or 3 order polynomial equation. The value is either completely valid or NaN.

I had originally tried to call polynomialbar2pow() but it always gives me unreasonable results. polynomialpow2bar(), and polynomialbar2pow() seem to reasonable duals when I first start with a polynomial, but not in these instances.

My hunch is I am possibly using it incorrectly? Or possibly using the wrong routine to curve fit a polynomial through a set of points defined by (tm, xa)? Or is there a bug here? When it works 99% of the time, my gut says bug, but this is my first attempt playing with the package, too. Help would be appreciated!

Thanks,

--Rob

Author:  Sergey.Bochkanov [ Tue Dec 07, 2010 7:21 am ]
Post subject:  Re: polynomialfit bug?

Can you post code/data which builds curve, tries to calculate it and gets NAN as result?

Author:  rbryce [ Tue Dec 07, 2010 11:30 pm ]
Post subject:  Re: polynomialfit bug?

i will asap!

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/