Opened 10 years ago

Closed 10 years ago

#13520 closed enhancement (fixed)

Derivative/integral of cubic splines in sage/gsl/interpolation.pyx

Reported by: Joris Vankerschaver Owned by: jason, jkantor
Priority: major Milestone: sage-5.5
Component: numerical Keywords: spline, gsl
Cc: Karl-Dieter Crisman Merged in: sage-5.5.beta1
Authors: Joris Vankerschaver Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #13519 Stopgaps:

Status badges

Description

This patch exposes methods from GSL to compute derivatives and definite integrals of cubic splines. This is done by adding two member functions to sage.gsl.interpolation.Spline.

Attachments (1)

13520-gsl-spline-int-diff.patch (3.9 KB) - added by Joris Vankerschaver 10 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 10 years ago by Joris Vankerschaver

Authors: Joris Vankerschaver
Dependencies: #13519
Status: newneeds_review

comment:2 Changed 10 years ago by Karl-Dieter Crisman

Cc: Karl-Dieter Crisman added

comment:3 Changed 10 years ago by Travis Scrimshaw

Reviewers: Travis Scrimshaw
Status: needs_reviewneeds_work

I get some precision errors:

**********************************************************************
File "/home/travis/sage-5.4.beta1/devel/sage-reviews/sage/gsl/interpolation.pyx", line 77:
    sage: s.derivative(5)
Expected:
    -0.16230085261803096
Got:
    -0.16230085261803057
**********************************************************************
File "/home/travis/sage-5.4.beta1/devel/sage-reviews/sage/gsl/interpolation.pyx", line 79:
    sage: s.derivative(6)
Expected:
    0.20997986285714798
Got:
    0.20997986285714818
**********************************************************************
File "/home/travis/sage-5.4.beta1/devel/sage-reviews/sage/gsl/interpolation.pyx", line 81:
    sage: s.derivative(5, order=2)
Expected:
    -3.0874707456138095
Got:
    -3.0874707456138086
**********************************************************************

I am running the tests on Ubuntu 10.04 on a VirtualBox VM with a host of Intel Core Duo T6400, with a 64-bit Vista OS.

comment:4 Changed 10 years ago by Joris Vankerschaver

Status: needs_workneeds_review

Thanks for letting me know about the precision issues. I've uploaded a new patch where I've truncated the offending floating point numbers.

comment:5 Changed 10 years ago by Travis Scrimshaw

Almost:

File "/home/travis/sage-5.4.beta1/devel/sage-reviews/sage/gsl/interpolation.pyx", line 79:
    sage: s.derivative(6)
Expected:
    0.209979862857147...
Got:
    0.20997986285714818
**********************************************************************
File "/home/travis/sage-5.4.beta1/devel/sage-reviews/sage/gsl/interpolation.pyx", line 81:
    sage: s.derivative(5, order=2)
Expected:
    -3.087470745613809...
Got:
    -3.0874707456138086

Just remove the 7 and the 9 on the respective lines and then all tests passed for me. Thanks.

Changed 10 years ago by Joris Vankerschaver

comment:6 Changed 10 years ago by Joris Vankerschaver

Aaahhh :) Ok, I've removed those digits in the latest version of the patch.

comment:7 Changed 10 years ago by Travis Scrimshaw

Milestone: sage-5.4sage-5.5
Status: needs_reviewpositive_review

Works for me now. Thank you.

Travis

comment:8 Changed 10 years ago by Joris Vankerschaver

Thanks for the positive review and for the many helpful comments!

comment:9 Changed 10 years ago by Jeroen Demeyer

Merged in: sage-5.5.beta1
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.