forum.alglib.net

ALGLIB forum
It is currently Sat Apr 27, 2024 11:17 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: polynomialfit bug?
PostPosted: Mon Dec 06, 2010 7:31 pm 
Offline

Joined: Mon Dec 06, 2010 7:11 pm
Posts: 2
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


Top
 Profile  
 
 Post subject: Re: polynomialfit bug?
PostPosted: Tue Dec 07, 2010 7:21 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 906
Can you post code/data which builds curve, tries to calculate it and gets NAN as result?


Top
 Profile  
 
 Post subject: Re: polynomialfit bug?
PostPosted: Tue Dec 07, 2010 11:30 pm 
Offline

Joined: Mon Dec 06, 2010 7:11 pm
Posts: 2
i will asap!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 313 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group