Fractional derivatives of exp(-x*x), starting with original function (order 0, blue) all the way to second derivative (order 2, yellow) in steps of 0.2

Interactive Fractional Derivative Playground

Real-time visuals for everyone

Johannes Bader
Aug 31, 2018 · 3 min read

This is just a short story about the online Fractional Derivative Playground that I created out of plain curiosity but wanted to share with other curious minds. Disclaimer: I am not a mathematician, so take everything I claim or the playground shows with a grain of salt.

TL;DR: Fractional derivatives are a thing; I couldn’t find any nice interactive online visualization; I made one; let me know what you think!


Inspiration

I didn’t even know that “fractional integrals/derivatives” are a thing until I found Dr. Peyam’s Definition of the Half Derivative on YouTube. Analysis was never my favorite branch of mathematics (I like discrete and meta things directly relevant to programming; monads!), but the phrase “half derivative” made me raise an eyebrow.

Wow, learning about the existence of that thing was one of those moments of inspiration and enlightenment that get so rare the older you get. Remember the first time you learnt about the relationship between Pascal’s Triangle and the Sierpiński Triangle? That.

Lack of Intuition

So you learn about this formula to compute a fractional derivative of order α and about a few examples of special functions (like sin(x) or x^n) where the formula simplifies nicely. But what do other functions look like? I don’t want to spend ages reducing a formula for some specific α, especially given that symbolic integration gets very hard very quickly. Numerical integration on the other hand is what PCs are good for!

How can you build an intuition about fractional derivatives without some nice plots? The closest thing I could find was this gif for f(x)=x. I wanted a website plotting the order α derivative of f, letting you specify f and α.

Result

large plot area constantly showing f and f’ (dashed) as well as a fractional derivative specified by you

I hacked together approximations of both Riemann–Liouville derivative and Grünwald–Letnikov derivative. Note that the GUI let’s you choose the algorithm used via the drop-down at the bottom. Sources of inaccuracy in my approximations:

What’s next?

This is a dirty hack but it does what I want. Here is a taste of what I mean when I say “hack”:

non-scientific test for divergence followed by non-scientific choice of magic numbers

I’m aware that there is scientific work about quickly evaluating fractional derivatives with reasonable error and such. I don’t even know how wrong my approximations are (you can sometimes observe a slight jump when switching between the two algorithms). Scrolling through the papers I realized that there is quite some work involved compared to what I did so far, so I decided to not prioritize it. My initial goal of having a tool to build intuition is achieved. But you are more than welcome to contribute!

There is of course also room for improvement at other spots, for example the “eval” way to specify f that let’s you shoot yourself in the foot.

Johannes Bader

Written by

compiler and programming language enthusiast

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade