3
$\begingroup$

Let's take this interpolated function:

f = ListInterpolation[{1, 2, 3, 5, 8, 5}]

I want to make 1/f'[x] go through a certain point (x=2, y=1, say). How can I do it?

enter image description here

The brute force way seems to be generating a list of 1/f'[x] for several values of $x$, artificially shifting the $x=2$ value to $y=1$, and then generating another interpolation function through the new list - but it seems extremely clunky.

$\endgroup$
0

1 Answer 1

4
$\begingroup$

As kglr notes in a comment, this is where you realize that you need a piecewise Hermite interpolant. Luckily, the Interpolation[] function in Mathematica can do this.

ff = Interpolation[{{{1}, 1}, {{2}, 2, 1}, {{3}, 3}, {{4}, 5}, {{5}, 8}, {{6}, 5}}];

1/ff'[2]
   1

Plot[ff[x], {x, 1, 6}, 
     Epilog -> {Directive[ColorData[97, 4], AbsolutePointSize[5]], 
                Point[MapIndexed[Append[#2, #1] &, {1, 2, 3, 5, 8, 5}]]}]

piecewise Hermite interpolant

$\endgroup$
2
  • $\begingroup$ You additionally need InterpolationOrder -> 6 to get a smooth derivative curve Plot[ff'[x], {x, 1, 6}] . $\endgroup$
    – Akku14
    Commented Jan 29, 2020 at 5:56
  • 1
    $\begingroup$ The OP didn't specify the order of continuity wanted, so I left it at that. Indeed, the InterpolationOrder can be increased if wanted. $\endgroup$ Commented Jan 29, 2020 at 6:26

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.