2
$\begingroup$

Question

I want to calculate the FractionalD of an InterpolatingFunction object, however, evaluating

FractionalD[Interpolation[Range[5]][x],{x,1/2}]

evaluates the argument but FractionalD remains unchanged, returning

FractionalD[ InterpolatingFunction[(* Something *)] ]

I would have expected an InterpolatingFunction object, the same output as Interpolation[Sqrt[Range[5]]*2/Sqrt[Pi]]

enter image description here

How to calculate the fractional derivative of an InterpolatingFunction so the output is another InterpolatingFunction?


Background

Fractional Derivatives

On the one hand, Wolfram Language (Mathematica) is fully capable of performing symbolic calculations of Fractional Derivatives defined as

enter image description here

For example,using FractionalD, FractionalD[f[x],{x,α}] gives the Riemann–Liouville fractional derivative of order α of the function $f(x)$,

FractionalD[x,{x,1/2}]

enter image description here

Interpolating Functions

On the other hand, one can take derivatives of InterpolatingFunction objects using D and Derivative.

For example,

D[Interpolation[Range[9]][x],x]

enter image description here

Visually,

Plot[
    Evaluate[
        {
            Interpolation[Range[5]][x],
            D[Interpolation[Range[5]][x],x]
        }
    ]
    ,{x,0, 3}
]

enter image description here


Due diligence

Web

I have searched the site and the web for the relevant keywords, unsuccessfully.

Piecewise (edited)

Thanks to @MichaelE2way for pointing out that @CarlWoll 's InterpolationToPiecewise transforms an InterpolatingFunction (only "Hermite" Method) into a Piecewise object. In that particular case, the answer would be more straightforward, as FractionalD does evaluate over Piecewise functions and one could re-build the InterpolatingFunction with FunctionInterpolation. I'm still interested in alternative solutions.

NFractionalD

It seems NFractionalD does work with InterpolatingFunction

NFractionalD[Interpolation[Range[9]][x], {x, 1/2}, 0.25]

But that would imply that I need to deconstruct the InterpolatingFunction to extract the data points to use NFractionalD in each point to then build a new InterpolatingFunction using Interpolation. That looks too cumbersome and error-prone.

$\endgroup$
4
  • 1
    $\begingroup$ To me, considering that NFractionalD does work, this seems like an oversight from Wolfram Research, FractionalD should work on InterpolatingFunction natively. $\endgroup$
    – rhermans
    Commented Aug 25, 2023 at 10:37
  • 1
    $\begingroup$ Maybe this will help: mathematica.stackexchange.com/questions/59944/… $\endgroup$
    – Michael E2
    Commented Aug 25, 2023 at 11:08
  • $\begingroup$ Thanks@MichaelE2, I need to check in detail, but after a quick glance I gather these solutions work only for InterpolatingFunction defined by crossing points, but not by its derivatives, like this smooth staircase Interpolation[Table[{{x},x,0,0,0,0},{x,0,9}]]. $\endgroup$
    – rhermans
    Commented Aug 25, 2023 at 12:37
  • 2
    $\begingroup$ Carl Woll's InterpolationToPiecewise seems to give the exact form for whatever is the underlying interpoation order. I think my answer does order 3 only. $\endgroup$
    – Michael E2
    Commented Aug 25, 2023 at 16:25

0

Your Answer

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