Q:

Computing the Caputo fractional derivative of a polynomial

In fractional calculus, the Caputo derivative of a monomial has the following form:
$$\operatorname{\mathit D}_t^\alpha\,t^\beta = \frac{\Gamma(\beta+1)}{\Gamma(\beta-\alpha+1)}t^{\beta-\alpha}$$
I wish to compute the Caputo derivative of $x(1+t^2)$ with respect to $t$.
I tried the following code:
 β = 2;
 u[x_, t_] = x*(t^0 +t^β);
 u[x, t] /. {x -> x, t^0 -> t^α/Gamma[1 - α], 
   t^β -> 
    Gamma[β + 1]/
     Gamma[β - α + 1] t^(β - α)}

and obtain the following output:
 
But I think this code is not correct.  Any suggestion? 

A:

Here is a somewhat general implementation of the Caputo fractional derivative with arbitrary lower limit (set to $0$ by default):
caputo[f_, {x_, α_, a_: 0}, opts___] /; Positive[α] && !  IntegerQ[α] :=
       Module[{n = Ceiling[α], t},
              (Convolve[UnitStep[x - a] D[f, {x, n}], x^(n - α - 1), x, t, opts] /.
               t -> x)/Gamma[n - α]]

(A fully general routine will include the special case of integer $\alpha$, of course; that is left as an exercise for the reader.) 
This should now work for any arbitrary function; e.g.
caputo[x^6, {x, 4/3}]
   (2187 x^(14/3))/(154 Gamma[2/3])

caputo[Sin[x], {x, 1/2}] // FullSimplify
   (Cos[x] (-I + 2 FresnelC[Sqrt[2/Pi] Sqrt[x]]) +
    (I + 2 FresnelS[Sqrt[2/Pi] Sqrt[x]]) Sin[x])/Sqrt[2]

