Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Suppose I have a list of lists, i.e.

list = Table[{x, x^ k}, {k, 1, 10}, {x, 0, 1, 0.05}];

and I want to interpolate each of the lists by a function using Interpolation (or another appropriate function). Is there a way to create a function of k and x, i.e

Table[interpFunct[k] = Interpolation@list[[k]],{k,1,10}]

so I have interpFunct[1,x], interpFunct[2,x], etc. available?

I know I can interpolate the surface but the mesh is not structured, which leads to new difficulties that have nothing to do with my needs.

Any advice will be very helpfull.

share|improve this question
You just need to tell it what to do with the second argument: Table[interpFunct[k, x_] = Interpolation[list[[k]]][x], {k, 10}] –  wxffles Nov 19 '12 at 3:37
@wxffles Crap, I knew my q. was kinda lame. Thanks a lot. Two things (lame as well): 1. Is there a way to define the domain of interpolation? 2. Even though it is a dumb question, I'll accept your comment as an answer. –  Pragabhava Nov 19 '12 at 3:53
Can I suggest to @wxffles to post and answer instead of a comment, no matter how "trivial"? It helps everybody 8^) –  caya Nov 19 '12 at 10:00

2 Answers 2

up vote 1 down vote accepted

As in the comments here's an answer, plus some variations:

Table[interpFunct[k, x_] = Interpolation[list[[k]]][x], {k, Length[list]}]

(interpFunct[#, x_] = Interpolation[list[[#]]][x]) & /@ Range[Length[list]]

Scan[(interpFunct[#, x_] = Interpolation[list[[#]]][x]) &, Range[Length[list]]]

MapIndexed[(interpFunct[#2[[1]], x_] = Interpolation[#1][x]) &, list]
share|improve this answer
Thanks a lot :) –  Pragabhava Nov 19 '12 at 19:21

I'd normally use Scan[] for the purpose of building a bunch of functions, but the indexing makes the use of MapIndexed[] so tempting:

list = Table[{x, x^k}, {k, 1, 10}, {x, 0, 1, 0.05}];

MapIndexed[With[{k = First[#2]}, interpFunct[k] = Interpolation[#1]] &, list];

Plot[Table[interpFunct[k][x], {k, 10}] // Evaluate, {x, 0, 1}]

plots of interpolants

share|improve this answer
Thanks for taking the time to help. With all this new functions, I've a lot of reading to do! –  Pragabhava Nov 20 '12 at 16:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.