# Fractional derivatives

Last time we have seen that ARMA modelis can be integrated (and differentiated) to deal with non-stationarity present in the empirical data. ARIMA model should be sufficient in most cases, but if the empirical data is know to exhibit "true" long-range memory, then ordinary calculus will not work. In those cases one would have to use fractional calculus. Here we will take a brief look at fractional derivatives (and integrals).

## General theory

The first major step in journey towards fractional calculus is an observation made by Cauchy. He had observed that if we want to integrate function $$n$$ times, it is easier to use the following formula:

$$I^n \left\{ f(x) \right\} = \frac{1}{(n-1)!} \int_a^x (x-t)^{n-1} f(t) \mathrm{d} t.$$

In the above $$I^n \left\{ \ldots \right\}$$ is integration operator applied $$n$$ times. Obviously factorial works only for positive integers, but factorial can be replaced by gamma function:

$$\Gamma (n) = \int_0^\infty e^{-s} s^{n-1} \mathrm{d} s = (n-1)! ,$$

which allows us to extend the domain to positive real numbers. With this we arrive at Riemann-Liouville integral, but we can't simply take negative value of $$n$$ to get the derivative. Still we can make use of this integral to it define fractional derivative, $$D^n$$:

$$D^n f = \frac{\mathrm{d}^{\lceil n \rceil}}{\mathrm{d} x^{\lceil n \rceil}} \left( I^{\lceil n \rceil - n} f \right) .$$

In the above $$\lceil \ldots \rceil$$ rounds numbers up (takes a ceiling of a number). To understand why this equation works try selecting and entering certain values of $$n$$. For integer $$n$$ the integration operator becomes $$I^0$$ and disappears, only $$n$$-th derivative remains. For positive real $$n$$, derivative remains of some integer order, while the integral order is some positive fraction between 0 and 1. We can easily calculate this integral and then take the ordinary derivative to its output.

These theoretical points well discussed in the following video by vcubingx.

## Example: fractional derivative of $$f(x) = x$$

Let us assume that the order of derivative, $$n$$, is in $$(0, 1]$$.

$$D^n x = \frac{\mathrm{d}}{\mathrm{d} x} \left( I^{1-n} x \right) .$$

$$I^{1-n} x = \frac{1}{\Gamma(1-n)} \int_a^x (x-t)^{-n} t \mathrm{d} t.$$

Now lets do substitution $$u = x-t$$:

$$\int (x-t)^{-n} t \mathrm{d} t = \int u^{-n} (u-x) \mathrm{d} u = \int \left( u^{1-n} - x u^{-n} \right) \mathrm{d} u = \frac{u^{2-n}}{2-n} - x \frac{u^{1-n}}{1-n}$$

After a bit of algebra and setting $$a=0$$:

$$\int_0^x (x-t)^{-n} t \mathrm{d} t = \frac{x^{2-n}}{2 - 3 n + n^2} .$$

A bit more trivial algebra:

$$D^n x = \frac{1}{\Gamma(2-n)} x^{1-n} .$$

This kind of a lot of manual labor, but the end result looks nice.

If you want you can use the app below to see that fractional derivative continuously "interpolates" between the function, its derivative and anti-derivative.