Fork me on GitHub
Math for the people, by the people.

User login

cubic spline interpolation

Type of Math Object: 
Definition
Major Section: 
Reference

Mathematics Subject Classification

65-01 no label found

Comments

I'm a little concerned with the use of Matlab as an illustrating example.

First, it does not show an algorithm that computes a cubic spline interpolation, it just shows an example of how to use an already implemented routine in Matlab. I don't think this should be PlanetMath's job, the place for this is in Matlab documentation.

Second, if there's a piceof code with a 'plot' command, why not include the plot output in the article?

Third, Matlab is proprietary software, and I think it's a little against the spirit of this site to advertise it. If you look at GNU Octave, together with the Octave-forge package, it can execute the exact same piece of code.

I'm sure this issue will come up again in the future, so I would like to see some discussion. On these questions in general:
* Should PlanetMath try to be language neutral?
* If not, should Free software be pefered to proprietary software?
* If yes, should there be some "standard" syntax for the pseudocode
used to demonstrate algorithms?

> First, it does not show an algorithm that computes a cubic
> spline interpolation, it just shows an example of how to use
> an already implemented routine in Matlab. I don't think this
> should be PlanetMath's job, the place for this is in Matlab
> documentation.

I agree, there is no mathematical insight to this "demonstration". The algorithm should be re-coded in a simple manner if code is to be presented.

> Third, Matlab is proprietary software, and I think it's a
> little against the spirit of this site to advertise it. If
> you look at GNU Octave, together with the Octave-forge
> package, it can execute the exact same piece of code.

Personally I would tend to go with Octave first, but I think it is a bad idea to exclude mathlab/mathematica/whatever from the field. Octave is really obscure compared to them (and it is really only a clone of *old* matlab). Also there is a good argument for giving people experience with commercially-utilized packiages. Suggesting alternatives cannot hurt, but the issue is not so simple that we can just pick one of {free, commercial} for all of PlanetMath.

> * Should PlanetMath try to be language neutral?
> * If not, should Free software be pefered to proprietary
> software?

I see no reason to standardize on answers to any of these questions. The demonstration should be invariant of language and software; these are just tools that make doing work convenient for the author. What I am saying is not to expunge matlab code in favor of some neutral pseudocode, but to avoid doing anything obfuscated and provide plain-English explanations of what is complex.

> * If yes, should there be some "standard" syntax for the
> pseudocode used to demonstrate algorithms?

This doesn't seem to have anything to do with whether the languages used for workable code are free or proprietary, so I'm not sure why you qualified it.

I lean towards preferring, but not enforcing (certain) standards. Perhaps a good model for this would be w3c "recommendations": they become ad hoc standards because of (1) first complete and widely disseminated formulation (they fill a vacuum), and (2) voluntary merit-based support in the community. In this case, I think authors are actually yearning for some sort of standard. If we give them one, they will probably use it.

Logan wrote (I believe-- adapting an existing style) an algorithms environment, which he uses in his entries. We could use this. It is just up to us to document it, and provide some recommendations for pseudocode and "real" code.

apk

I personally also use octave and gp-pari, coding most needed functions myself. I also don't think it is wise to exclude any package just because it's commercial. Although any code used should make minimal use of unnecessary features. Any attempts to standardize could backfire, any code published should have been run and tested. If you have to change it to some pseudocode then you are guaranteeing lots of bugs.

The real reason I'm posting is that the example given seems largely replicated from the Matlab help page for spline
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/spline.shtml

I tend to agree with Igor that the use of non-free software
is somehow against the spirit of the site. It is not so
much commercial vs non commercial as free vs non-free.

I think that the community of Math people (amateurs or professionals)
should really support free computer algebra systems because any restriction
in the use and distribution of algorithms impedes the further progress
of math and science in general.

Besides the software already mentioned there is Maxima, whose
later versions are almost complete. Even if some of the free programs
are not as shiny as the non-free ones or they are missing features
they should be preferred over non free ones. In my humble opinion use
of non free systems should be only the last resource.

My position is that PlanetMath is not a proper place for examples of using computer algebra systems (CAS). This is not a PlanetCAS or PlanetProgramming. Implementation of cerain mathematical ideas in specific programming product (free or non-free, commercial or freeware) falls outside the scope of PlanetMath.

On the other hand, inclusion of mathematical algorithms with illustrations in any reasonable language should be welcome. The pseudo-code is more preferable because it is language-independent and relieves the reader of burden of unnecessary technical details associated with specific a language.

Boris

> My position is that PlanetMath is not a proper place for
> examples of using computer algebra systems (CAS). This is
> not a PlanetCAS or PlanetProgramming. Implementation of
> cerain mathematical ideas in specific programming product
> (free or non-free, commercial or freeware) falls outside the
> scope of PlanetMath.
>
> On the other hand, inclusion of mathematical algorithms with
> illustrations in any reasonable language should be welcome.
> The pseudo-code is more preferable because it is
> language-independent and relieves the reader of burden of
> unnecessary technical details associated with specific a
> language.

I strongly agree with this. I think there's little place on PlanetMath for complete implementations in any language. But including descriptions of algorithms and some pseudocode is ok.

I played with the idea of standardizing pseudocode, but from the ensuing discussion is seems that it would be conterproductive. Perhaps some style guidelines would be good.

Last, I think that _references_ to specific languages should be cut down to a minumum. I think the references in AlgebraicComputation are ok, but the one in CubicSplinInterpolation is out of line.

Take note of a few things:

1. matlab is not a programming language!
2. the commands given show how to compute a spline using matlab'b built in function "spline". This example was given to illustrate how computers may aid in learning.
3. the commands given, are not code, pseudocode or in the format of any programming language. They are commands issued directly to the matlab workspace.
4. The popular (and most widely used) programs for mathematics are the 3 M's, Mathematica, Matlab, and Maple. I am not in anyway advertising these programs. However, Matlab is the main program used by NASA, JPL and commercially in research. It is the preferred program in engineering.
5. The purpose of planetmath is to disseminate mathematical knowledge. Showing ways to apply knowledge learned from planetmath in computing is conducive to education and will aid people both in academia and their professional lives.
6. Personally, I wish more people would show the commands to apply their planetmath work to computing.
7. Cubic Spline Interpolation is what is defined in the subbmission and hence the name is more than appropriate.

> 1. matlab is not a programming language!

It is.

> 2. the commands given show how to compute a spline using
> matlab'b built in function "spline". This example was given
> to illustrate how computers may aid in learning.

That is really more pure applications than learning, as it did not yield any insight to the algorithm.

> 3. the commands given, are not code, pseudocode or in the
> format of any programming language. They are commands
> issued directly to the matlab workspace.

Matlab's commands *are* its programming language (not that this is particularly relevant to the issue at hand).

> 4. The popular (and most widely used) programs for
> mathematics are the 3 M's, Mathematica, Matlab, and Maple.
> I am not in anyway advertising these programs. However,
> Matlab is the main program used by NASA, JPL and
> commercially in research. It is the preferred program in
> engineering.

Yes, this is why I think it would be foolish to standardize on free alternatives.

> 5. The purpose of planetmath is to disseminate mathematical
> knowledge. Showing ways to apply knowledge learned from
> planetmath in computing is conducive to education and will
> aid people both in academia and their professional lives.
> 6. Personally, I wish more people would show the commands to
> apply their planetmath work to computing.

I think it would be more more elegant and pedagogical to put pseudocode (or the key portions of a matlab implementation) *within* the entry, and an a file attachment for mundane things like calling the built-in spline generator.

apk

> Take note of a few things:

I will address only the following:

> 2. the commands given show how to compute a spline using
> matlab'b built in function "spline". This example was given
> to illustrate how computers may aid in learning.
> 5. The purpose of planetmath is to disseminate mathematical
> knowledge. Showing ways to apply knowledge learned from
> planetmath in computing is conducive to education and will
> aid people both in academia and their professional lives.
> 6. Personally, I wish more people would show the commands to
> apply their planetmath work to computing.

My main point is that the piece of code that you gave
does not really help learn or apply what the entry talks
about. If you consider it an "application" of some knowledge
then the knowledge is that a cubic spline interpolation
routing exists in Matlab. Which is useful if you're trying
to find a program to compute splines, but not very useful
if you're trying to learn how to produce cubic splines on
a computer by yourself. Then, a description of the algorithm
itself (whatever the format, as long as its clear and
understandable) would be more useful.

I don't think anyone can argue about the popularity of Matlab,
but I don't think you can also argue that it's accesible to
everyone. For example a highschool student might be interested
in cubic splines, but may not have access to Matlab at school
and may not be able to afford it for home use. But just because
a program is free, doesn't meen that it's universally accessible,
either. There could be many reasons why someone cannot use it.
Since PlanetMath's goal is to disseminate mathematical knowledge
that is independent of which computer program it is applied to
or with, I think it should stay as independent as possible
specific computer programs, non matter what they are.

In the same spirit as my first paragraph, you could say that
cubic spline interpolation implementations exist in existing
software packages, such as Matlab, GNU Octave, Maple, Mathematica,
and others. If someone is interested in using any one of these
programs, they can lookup the relevant documentation for
themselves. This kind of statement gives more information
than you already provide, since it names more software packages
where cubic splines are available.

There is an "Interpolation" section (41A05) and a "Spline approximation"
section (41A15) in MSC. When you browse the encyclopedia by subjects,
having only one classification for each entry may get one miss many
relevant entries. So I suggest to add these two if possible.

Other point: the "natural" and "not-a-knot" end point conditions are the
same, which should be stated.

well.. when you ran across an entry and it doesn't shows up on the corresponding MSC section
it means the author forgot to add it, please file a meta/minor correction suggesting the proper code to be added to the entry
f
G -----> H G
p \ /_ ----- ~ f(G)
\ / f ker f
G/ker f

The "natural" and "not-a-knot" end conditions are not the same:
"not-a-knot" means x_1 and x_{N-1} have no discontinuity of
S'''. (It improves the fit. See Carl deBoor's "A practical
guide to splines", it should be there).

This is my entry and I wrote every word of it. I never orphaned it and you should be ashamed of yourself for putting you name on something that you had absolutly to contribution in.

Why then in the author history it is stated that:

User: tensorking
Why: Orphan
When: 2004-07-08

"but matches the first and second derivatives at the knots."

The derivatives are continuous across boundaries but do not in general match the TRUE derivatives anywhere. I assume what you are implying is that the derivatives of the spline on either side of a knot are MATCHED to one another. The original statement seemed misleading on first read.

I support completely the opinion of Igor.

Greetings for all.

Subscribe to Comments for "cubic spline interpolation"