0
$\begingroup$

If I interpolate a list

 f=ListInterpolation[{1,2,3,4,5,6,7}]

the result is in the domain {{1,7}}, so something like f[8] will be out of scope.

How can I shift the domain, say from 1,7 to 8,15?

$\endgroup$

1 Answer 1

1
$\begingroup$

One thing you can do is to shift the function:

f = ListInterpolation[{1, 2, 3, 4, 5, 6, 7}]
g[x_] := f[x - 7];

Now g is a shifted version of f having the domain starting at 8.

$\endgroup$
3
  • $\begingroup$ Or to get a periodic function: g[x_] := Mod[x, 7] /. (0 -> 7) $\endgroup$
    – Bob Hanlon
    Jul 4, 2018 at 14:35
  • $\begingroup$ @BobHanlon If one is aiming for periodicity, there is the PeriodicInterpolation option $\endgroup$
    – Lukas Lang
    Jul 4, 2018 at 15:14
  • $\begingroup$ @LukasLang - if you try that option you will encounter the error ListInterpolation::per : In dimension 1 the data at the endpoints of the fundamental period are not equal. $\endgroup$
    – Bob Hanlon
    Jul 4, 2018 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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