This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
possible bug in akima interpolation
- From: ABX <abx at abx dot art dot pl>
- To: gsl-discuss at sources dot redhat dot com
- Date: Wed, 16 Apr 2003 11:57:12 +0200
- Subject: possible bug in akima interpolation
- Organization: MDK/Ogryzek Crew
- Reply-to: abx at abx dot art dot pl
Hi, I'm new to the GSL and come here mainly to report possibility of bug.
I tried to implement akima interpolation in splines of POV-Ray. First I compared
how it looks with code from other sources. When I linked my application with
modules from GSL library I recived shape with bug in the most left point:
http://news.povray.org/povray.binaries.images/31227/221922/akima_spline.png
but when I used code from http://www.magic-software.com/Interpolation1D.html
I received almost similiar shape except all control points are "smooth"
http://news.povray.org/povray.binaries.images/31227/222064/akima_spline.png
Since both libraries are builded different way (temporary and helpers variables
are different) I not tried to compare details of implementations. But I suppose
the difference is located here:
GSL:
m[-2] = 3.0 * m[0] - 2.0 * m[1];
m[-1] = 2.0 * m[0] - m[1];
m[size - 1] = 2.0 * m[size - 2] - m[size - 3];
m[size] = 3.0 * m[size - 2] - 2.0 * m[size - 3];
Magic Software:
afSlope[1] = 2.0f*afSlope[2] - afSlope[3];
afSlope[0] = 2.0f*afSlope[1] - afSlope[2];
afSlope[iQuantity+1] = 2.0f*afSlope[iQuantity] - afSlope[iQuantity-1];
afSlope[iQuantity+2] = 2.0f*afSlope[iQuantity+1] - afSlope[iQuantity];
In my example splines were open, thought first and last point are equal. The
images were created with following set of data:
t,<x(t),y(t)>
0,<0,0>
1,<0,2>
2,<2,1>
3,<0,0>
4,<-1,2>
5,<-2,1>
6,<-1,-1>
7,<0,0>
ABX