1
$\begingroup$

I'm using a cubic spline interpolation for given data points. The boundary condition for the spline is that $f'(a)$ and $f'(b)$ are given (I'm using a finite difference formula $\frac{y_1-y_0}{x_1-x_0}$ to calculate the first derivatives $f'(a)$ and $f'(b)$, so they are not really given). With $a$ and $b$ being the boundaries. I ran into the problem, that my second derivative becomes really inaccurate at the boundary, if $f'(a)$ and $f'(b)$ aren't good approximations. I can't use a natural spline, since I also need a value for the second derivative at the endpoints. I'm using the spline to solve a stiff PDE. Are there any other good methods to approximate the first derivative at the endpoints?

$\endgroup$
1
  • $\begingroup$ You might also want to vote on the answer, in accordance with these guidelines $\endgroup$ Commented Mar 10, 2023 at 15:38

1 Answer 1

0
$\begingroup$

For instance, you can approximate $f(x)$ by the Newton interpolating polynomial $P(x)$ based on a number of nodes closest to (and including) a given endpoint $x_0$, and then approximate $f'(x_0)$ by $P'(x_0)$.


Here is an image of a Mathematica notebook illustrating this approach on simulated data:

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .