forum.alglib.net

ALGLIB forum
It is currently Fri Nov 08, 2024 11:04 am

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  [ 5 posts ] 
Author Message
 Post subject: Not clear result of approximation
PostPosted: Tue Mar 15, 2011 10:25 am 
Offline

Joined: Tue Mar 15, 2011 8:29 am
Posts: 3
Hi all. There is a problem.
I have tried to approximate a polynom of the third order
y:=-39.692 - 1.7902e-3*x + 1.8854e-7*x^2-8.4099e-12*x^3 by means of
a polynom of the third order. Used function LSFitLinear.
The result of approximation is resulted in drawing.
Attachment:
m1.JPG
m1.JPG [ 29.31 KiB | Viewed 5231 times ]

Blue color - initial function. Lilac - result of approximation.
The example of approximation of a tangent resulted on a site works normally.
I use ALGLIB with Delphi 7.
In what the reason of such result?


Top
 Profile  
 
 Post subject: Re: Not clear result of approximation
PostPosted: Tue Mar 15, 2011 7:24 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 925
I think that it is ill-conditioning issue. Maybe it is better to use Chebyshev polynomials as basis functions - at least for intermediate calculations.

What is the value of TaskRCond field of solver report?


Top
 Profile  
 
 Post subject: Re: Not clear result of approximation
PostPosted: Wed Mar 16, 2011 5:30 am 
Offline

Joined: Tue Mar 15, 2011 8:29 am
Posts: 3
The value of TaskRCond=5.92e-10.
I did such experiment: such values of function to set in points 0,1,2. 18.
Approximation was magnificent. Possibly reason in great values of argument. Whether there is a way to solve a problem within the limits of application Lsfitlinear?


Top
 Profile  
 
 Post subject: Re: Not clear result of approximation
PostPosted: Wed Mar 16, 2011 5:38 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 925
TaskRCond=5.92e-10 means that your problem is very badly conditioned. You have two ways to solve this issue:
* quick and dirty way - linearly map your points to [-1,+1], calculate approximation, then transform polynomial back to [0,12000]
* more efficient, but complex solution - linearly map your points to [-1,+1], calculate approximation using Chebyshev basis, then transform polynomial back to power basis and scale X to be in [0,12000].


Top
 Profile  
 
 Post subject: Re: Not clear result of approximation
PostPosted: Wed Mar 16, 2011 6:26 am 
Offline

Joined: Tue Mar 15, 2011 8:29 am
Posts: 3
All has understood. Thanks.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group