DifferentialEquations.jl and Measurements.jl



Today I was asked whether it was possible to solve in Julia differential equations involving numbers with uncertainties. Of course the answer is yes. What I find really amazing about Julia is that the two packages don’t know anything about each other, yet they can work together without any effort. Here is an short example based on this tutorial: https://nbviewer.jupyter.org/gist/giordano/e82a3959d8f64301129d64d004e10b4e

The only think I found weird was that the extrema of the time interval had to be Measurement objects, otherwise solve would complain (because it can’t convert Measurement type to Float64). Why it’s that? I can see why u0 should have the same type as that returned by f, but not why also the time should match the same type.


Adaptive timestepping. When using adaptive timestepping (the default), the times that the solver is internally doing have an uncertainty as well since its steps are determined by the ODE system itself, so it needs to keep track of the uncertainty in time.

Cool stuff, I like it when Julia makes new features for us :smile:. Would you mind doing a PR to https://github.com/JuliaDiffEq/DiffEqTutorials.jl ?


Thank you for the explanation!

Yes, I was thinking about adding a tutorial, but I’d like to come up with a different example rather than just copying another tutorial :smile: