Skip to content

Instantly share code, notes, and snippets.

@mtesseracted
Created February 1, 2022 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtesseracted/acb16dcc1b744faa9c762c19d81bcf78 to your computer and use it in GitHub Desktop.
Save mtesseracted/acb16dcc1b744faa9c762c19d81bcf78 to your computer and use it in GitHub Desktop.
fractional derivatives of xe^x
(* found at https://community.wolfram.com/groups/-/m/t/1313893 *)
(* \
modified as per reddit user u/wxehtexw to integrate from -inf instead \
of 0 *)
FractionalD[\[Alpha]_, f_, x_, opts___] :=
Integrate[(x - t)^(-\[Alpha] - 1) (f /. x -> t), {t, -Infinity, x},
opts, GenerateConditions -> False]/Gamma[-\[Alpha]]
FractionalD[\[Alpha]_?Positive, f_, x_, opts___] :=
Module[{m = Ceiling[\[Alpha]]},
If[\[Alpha] \[Element] Integers, D[f, {x, \[Alpha]}],
D[FractionalD[-(m - \[Alpha]), f, x, opts], {x, m}]]]
(* sanity checks *)
f[x_] := x^2
FractionalD[1, f[x], x]
f[x_] := Sin[x]
FractionalD[-1, f[x], x]
f[x_] := Exp[x]
FractionalD[1, f[x], x]
FractionalD[1/2, f[x], x]
Simplify[FractionalD[3/2, f[x], x]]
(* test on xe^x *)
g[x_] := x Exp[x]
FullSimplify[FractionalD[1/4, g[x], x]]
FullSimplify[FractionalD[1/3, g[x], x]]
Simplify[FractionalD[1/2, g[x], x]]
FullSimplify[FractionalD[2/3, g[x], x]]
FullSimplify[FractionalD[3/4, g[x], x]]
Simplify[FractionalD[1, g[x], x]]
FullSimplify[FractionalD[5/4, g[x], x]]
FullSimplify[FractionalD[4/3, g[x], x]]
Simplify[FractionalD[3/2, g[x], x]]
Simplify[FractionalD[2, g[x], x]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment