Post Reply 
Higher order derivatives of unequally spaced data
07-06-2021, 08:48 PM (This post was last modified: 07-06-2021 08:50 PM by Namir.)
Post: #1
Higher order derivatives of unequally spaced data
Hi All,

I found on the Internet several documents and power points that describe how to estimate the first and second derivatives of unequally spaced points based on quadratic Lagrangian polynomials.

I posted on my web site (click here to download) a short paper that presents first, second, third, and fourth derivatives based on cubic and quartic Lagrange polynomials. I used some free online tools to help me formulate the equations for these derivative estimates. The paper includes the pseudo-code for these methods along with source code in Excel VBA, Matlab, and Python.

These derivatives are helpful in estimating the rate of changes in physical of chemical process where the physical/chemical property is measured at irregular intervals.

Namir
Find all posts by this user
Quote this message in a reply
07-07-2021, 05:45 PM
Post: #2
RE: Higher order derivatives of unequally spaced data
For derivatives, we may remove 1 term of Lagrange polynomial.

(f(x))' = (f(x) - c)', for constant c

Example, with 3 points:

\( f(x)
≈ f(x_1)\left({(x-x_2)(x-x_3) \over (x_1-x_2)(x_1-x_3)}\right)
+ f(x_2)\left({(x-x_1)(x-x_3) \over (x_2-x_1)(x_2-x_3)}\right)
+ f(x_3)\left({(x-x_1)(x-x_2) \over (x_3-x_1)(x_3-x_2)}\right)
\)

Let \(c = f(x_2)\), we eliminated middle term:

\( f'(x)
≈ \Big(f(x_1) - f(x_2)\Big) \left({(x-x_2)+(x-x_3) \over (x_1-x_2)(x_1-x_3)}\right)
+ \Big(f(x_3) - f(x_2)\Big) \left({(x-x_1)+(x-x_2) \over (x_3-x_1)(x_3-x_2)}\right)
\)

Simplify with Divided Differences Notation:

\(\begin{align} f'(x)
&≈ {f[x_1,x_2] \over x_3-x_1} (x_2+x_3-2x)
+ {f[x_2,x_3] \over x_3-x_1} (2x-x_1-x_2) \\
&= {f[x_1,x_2] \over x_3-x_1} (x_2+x_3-2x)
+ \left(f[x_1,x_2,x_3] + {f[x_1,x_2] \over x_3-x_1}\right) (2x-x_1-x_2) \\
&= f[x_1,x_2] + f[x_1,x_2,x_3] \, (2x-x_1-x_2)
\end{align}\)

We can confirm above, with 3-points Divided-difference formula

\(f(x) ≈ f(x_1) + (x-x_1) \Big(f[x_1,x_2] + (x-x_2)\,f[x_1,x_2,x_3] \Big) \)

Differentiate with respect to x, we get back the same f'(x)
Find all posts by this user
Quote this message in a reply
07-10-2021, 11:05 PM
Post: #3
RE: Higher order derivatives of unequally spaced data
Thanks Albert! I may updated my paper to include a version of algorithms and source codes that are based on Newton divided-difference polynomials.

Namir
Find all posts by this user
Quote this message in a reply
07-17-2021, 12:45 PM
Post: #4
RE: Higher order derivatives of unequally spaced data
Hi All,

I have updated my original paper to include higher order derivatives of unequally spaced data using Newton's divided-difference interpolation polynomials. The update also includes source code functions in Excel VBA, Matlab, and Python.

To access the updated paper click here.

Enjoy!

Namir
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)