forum.alglib.net http://forum.alglib.net/ |
|
Not clear result of approximation http://forum.alglib.net/viewtopic.php?f=2&t=321 |
Page 1 of 1 |
Author: | aym53 [ Tue Mar 15, 2011 10:25 am ] |
Post subject: | Not clear result of approximation |
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 [ 29.31 KiB | Viewed 5445 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? |
Author: | Sergey.Bochkanov [ Tue Mar 15, 2011 7:24 pm ] |
Post subject: | Re: Not clear result of approximation |
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? |
Author: | aym53 [ Wed Mar 16, 2011 5:30 am ] |
Post subject: | Re: Not clear result of approximation |
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? |
Author: | Sergey.Bochkanov [ Wed Mar 16, 2011 5:38 am ] |
Post subject: | Re: Not clear result of approximation |
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]. |
Author: | aym53 [ Wed Mar 16, 2011 6:26 am ] |
Post subject: | Re: Not clear result of approximation |
All has understood. Thanks. |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |