Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5944181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:30:04+00:00 2026-05-22T16:30:04+00:00

I’m reverse-engineering how Mathematica does list interpolation: (* Fortunately, Mathematica WILL interpolate an arbitrary

  • 0

I’m reverse-engineering how Mathematica does list interpolation:

(* Fortunately, Mathematica WILL interpolate an arbitrary list *) 

tab = Table[a[i], {i,1,100}] 

f = Interpolation[tab] 

(* get the coefficient of each term by setting others to zero *) 

Plot[{f[42+x] /. {a[42] -> 0, a[43] ->0, a[44] -> 0, a[41] -> 1}}, 
 {x,0,1}] 

Plot[{f[42+x] /. {a[41] -> 0, a[43] ->0, a[44] -> 0, a[42] -> 1}}, 
 {x,0,1}] 

Plot[{f[42+x] /. {a[42] -> 0, a[41] ->0, a[44] -> 0, a[43] -> 1}}, 
 {x,0,1}] 

Plot[{f[42+x] /. {a[42] -> 0, a[43] ->0, a[41] -> 0, a[44] -> 1}}, 
 {x,0,1}] 

(* above is neither Hermite, nor linear, though some look close *) 

(* these are available at oneoff.barrycarter.info/STACK/ *) 

Table[f[42+x] /. {a[42] -> 0, a[43] ->0, a[44] -> 0, a[41] -> 1}, 
 {x,0,1, 1/100}] >> /home/barrycarter/BCINFO/ONEOFF/STACK/coeff41.txt 

Table[f[42+x] /. {a[41] -> 0, a[43] ->0, a[44] -> 0, a[42] -> 1}, 
 {x,0,1, 1/100}] >> /home/barrycarter/BCINFO/ONEOFF/STACK/coeff42.txt 

Table[f[42+x] /. {a[41] -> 0, a[42] ->0, a[44] -> 0, a[43] -> 1}, 
 {x,0,1, 1/100}] >> /home/barrycarter/BCINFO/ONEOFF/STACK/coeff43.txt 

Table[f[42+x] /. {a[41] -> 0, a[42] ->0, a[43] -> 0, a[44] -> 1}, 
 {x,0,1, 1/100}] >> /home/barrycarter/BCINFO/ONEOFF/STACK/coeff44.txt

EDIT: Thanks, whuber! That did exactly what I wanted. For reference, the coefficients are (in order):

(x-2)*(x-1)*x/-6
(x-2)*(x-1)*(x+1)/2
x*(x+1)*(x-2)/-2
(x-1)*x*(x+1)/6
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:30:05+00:00Added an answer on May 22, 2026 at 4:30 pm

    According to the documentation the interpolator is piecewise polynomial. That’s a little vague, so there is something to be investigated here.

    You can establish experimentally that the interpolator is a linear function of the data. A nice basis for all possible data consists of vectors of the form {1,0,…,0}, {0,1,0,…,0}, …, {0,…,0,1}. To this end, let’s build a tiny function to produce these vectors of length $n$:

    test[n_, i_] := Module[{x = ConstantArray[0,n]},x[[i]] = 1; x]
    

    You can confirm the linearity by trying some examples like this one, with coefficients $a$ and $b$ acting on the $i^\text{th}$ and $j^\text{th}$ basis vectors of length $n$:

    With[{a=1, b=2.5, n=5, i=2, j=3},
        Plot[{Interpolation[a test[n,i] + b test[n,j]][x], 
            a Interpolation[test[n,i]][x] + b Interpolation[test[n,j]][x]}, {x, 1, n}]
    ]
    

    There will be but a single curve because the two functions are superimposed.

    Having established the linearity, it will suffice to analyze the interpolator’s values on the $n$ basis vectors. You can determine the degrees of the polynomials by differentiation. By default the degree is 3, but you can modify that with the “InterpolatingOrder” parameter. The following code will plot a table of obviously piecewise constant curves resulting from the derivatives of the interpolator for interpolating orders 1 through ioMax, using all the basis vectors for data of length $n$:

    With[{n=7, ioMax = 5},
        Table[
            Module[{fns},
                fns = Table[Interpolation[test[n,i], InterpolationOrder->io], {i,1,n}];
                Table[Plot[Evaluate@D[f[#], {#,io}]&[x], {x,1,n},
                    PlotRange->Full, PlotStyle->Thick, ImageSize->150], {f, fns}]
            ], {io, 1, ioMax}
        ]
    ] // TableForm
    

    The output shows that the breaks occur at the integer values of the argument and that there are at most $n-d$ distinct segments for data of length $n$ and an interpolator of degree $d$. This information should get you most of the way there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I need a function that will clean a strings' special characters. I do NOT
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.