Opened 10 years ago

Closed 10 years ago

#13519 closed defect (fixed)

Spline is not recomputed when interpolation points change

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.beta0
Authors: Joris Vankerschaver Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

The sage.gsl.interpolation.Spline class does not recompute the spline when the interpolation points are changed:

sage: S = spline([(1,1), (2,3), (4,5), (5, 4)]); S
[(1, 1), (2, 3), (4, 5), (5, 4)]
sage: S(4.1)
4.953437500000001
sage: del S[1]; S
[(1, 1), (4, 5), (5, 4)]
sage: S(4.1)
4.953437500000001
sage: S.append((4, 100)); S
[(1, 1), (4, 5), (5, 4), (4, 100)]
sage: S(4.1)
4.953437500000001

Attachments (1)

13519-gsl-spline.patch (4.3 KB) - added by Joris Vankerschaver 10 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 10 years ago by Joris Vankerschaver

Authors: Joris Vankerschaver
Status: newneeds_review

The patch corrects this behavior and adds some examples to the class docstring.

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

Cc: Karl-Dieter Crisman added

comment:3 Changed 10 years ago by Travis Scrimshaw

Status: needs_reviewneeds_work

I get the following errors

File "/home/travis/sage-5.4.beta1/devel/sage-reviews/sage/gsl/interpolation.pyx", line 30:
    sage: S(1.5)
Expected:
    2.507575757575758
Got:
    2.5075757575757573
**********************************************************************
File "/home/travis/sage-5.4.beta1/devel/sage-reviews/sage/gsl/interpolation.pyx", line 44:
    sage: S(1.5)
Expected:
    2.507575757575758
Got:
    2.5075757575757573
**********************************************************************

which is just a rounding issue. The rest of the documentation has 16 numbers after the decimal.

Also I think you should use single backticks to get math mode and double backticks for inline code in the documentation, and use the automatic trac link :trac:'13519' where the single quotes are backticks (since I don't know how to get the escape to work here) instead of #13519 on line 131. The functionality looks good otherwise.

Changed 10 years ago by Joris Vankerschaver

Attachment: 13519-gsl-spline.patch added

comment:4 Changed 10 years ago by Joris Vankerschaver

Status: needs_workneeds_review

Hey Travis, nice catch. I've uploaded a new version of the patch, where I've made the following changes:

  1. I didn't have the rounding issue on my machine, but to make things more robust I've replaced the last few digits of each repeating decimal expansion by an ellipsis.
  2. I've incorporated the automatic links to trac and the formatting for math mode and inline code. I've also made this change elsewhere in the file, so the resulting patch is a little larger than the previous one, but all the new changes just concern formatting.

Let me know if you have any further suggestions for changes.

comment:5 Changed 10 years ago by Travis Scrimshaw

Reviewers: Travis Scrimshaw
Status: needs_reviewpositive_review

Looks good to me.

comment:6 Changed 10 years ago by Jeroen Demeyer

Milestone: sage-5.4sage-5.5

comment:7 Changed 10 years ago by Joris Vankerschaver

Thanks, Travis! If you don't mind, can I interest you in #13520 and #13530, which are small variations on this theme?

comment:8 Changed 10 years ago by Jeroen Demeyer

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