bugGNU Octave - Bugs: bug #39574, spline produces incorrect results...

 
 

bug #39574: spline produces incorrect results in the 'complete' situation

Submitter:  Andreas Stahel <sha1>
Submitted:  Fri 26 Jul 2013 04:03:57 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Andreas Stahel Open/Closed:  * Closed
Release:  * 3.6.4 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 16 Aug 2013 07:35:55 PM UTC, comment #7: 

Fixed in csape in the current version of the spline package.

Nir Krakauer <nir_krakauer>
Wed 31 Jul 2013 02:11:52 PM UTC, comment #6: 

Hello Nir

the spline() command worked for more than 3 points and the patch by marco is only executed with exately 3 points. Thus the situation with more that 3 points remains stable, and correct for sample I used.

Hope this helps

Andreas

Andreas Stahel <sha1>
Wed 31 Jul 2013 02:08:33 PM UTC, comment #5: 

I will fix this for csape in the next release of the splines package.

Also, can you test whether the results returned are correct when there are more than three points?

Nir Krakauer <nir_krakauer>
Tue 30 Jul 2013 05:08:10 PM UTC, comment #4: 

Hello again

Thank you Marco for the patch. It worked flawless in my small test case!

Andreas

Andreas Stahel <sha1>
Tue 30 Jul 2013 11:10:37 AM UTC, comment #3: 

Hi,

I think lines


dg = 1.5 * h(1) - 0.5 * h(2);
c(2:n-1,:) = 1/dg(1);


in spline.m should be replaced by


c(2,:) = (3*(a(3,:)-a(2,:))/h(2)-3*(a(2,:)-a(1,:))/h(1)+...
          dfs-dfe)/(h(1)+h(2));


Marco

Marco Caliari <caliari>
Group Member
Mon 29 Jul 2013 06:47:34 AM UTC, comment #2: 

Hello again

enclose (file spline3points.mat) the results by matlab for t and ys.

I hope it helps

Andreas

(file #28685)

Andreas Stahel <sha1>
Sun 28 Jul 2013 02:42:18 PM UTC, comment #1: 

Thanks, I'll look into this. Can you post the output Matlab gives?

Nir Krakauer <nir_krakauer>
Fri 26 Jul 2013 04:03:57 PM UTC, original submission:  

Dear developers

The two codes code below should produce identical results.
spline() (and csape() from the splines package) fail
if three points and the derivatives at the boundary are supplied.
Matlab produces the expected result

x = linspace(0,pi/2,3); y = sin(x);
t = linspace(0,pi/2);

ys = spline(x,y,t);  % is OK
plot(t,ys)
ys = spline(x,[1 y 0],t);  % is not OK
plot(t,ys)


Thank you for the good work

Andreas

Andreas Stahel <sha1>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #28685:  spline3points.mat added by sha1 (2KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by caliari (Posted a comment)
  • -email is unavailable- added by nir_krakauer (Posted a comment)
  • -email is unavailable- added by sha1 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-10-17 rik5 CategoryOctave Function Octave Package
        StatusNone Fixed
        Open/ClosedOpen Closed
    2013-07-29 sha1 Attached File- Added spline3points.mat, #28685

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code