A lazy way to solve differential equations
iagoleal.com
iagoleal.com
https://docs.sciml.ai/dev/modules/DiffEqDocs/solvers/ode_sol...
The implementation described here is missing a lot of the optimizations that TaylorIntegration.jl employs (it makes the method no longer simple), but after doing some of the extra stuff you can find that Taylor integration methods can be good if you need really high accuracy. Some examples of this are seen in some of the SciMLBenchmarks, particularly https://benchmarks.sciml.ai/html/DynamicalODE/Henon-Heiles_e... and https://benchmarks.sciml.ai/html/DynamicalODE/Quadrupole_bos... .
One of the nice things about Taylor integration methods is that they can be used to build interval solutions of ODEs which guarantee the solution. That's described in some detail in this video: https://www.youtube.com/watch?v=o1h7BUW04NI .
There's also an introductory textbook about ODEs ("Exploring ODEs") that uses chebfun [2] throughout.
As well as the original MATLAB implementation, there are now implementations in Julia, Python, and some other languages [3].
The Chebyshev basis in time is still not great. This was used in Chebfun before but there's a note that for time to just use standard ODE solvers because it did not good performance. Collocation really only makes sense on BVPs.
This distinction between initial value problems (IVP, one endpoint known, hence a “time” differential equation) and BVPs (both endpoints known, not “time”) also appears in this introduction to the Chebfun solvers:
https://www.chebfun.org/docs/guide/guide07.html (last paragraph of sec 7.1)
Following the breadcrumbs to the IVP treatment in chapter 10
https://www.chebfun.org/docs/guide/guide10.html (Sec 10.2)
we read:
A major change was introduced in Version 5.1 in how initial-value (and final-value) problems are solved. Before, Chebfun used the same global spectral representations as for BVPs. This usually works fine for linear problems, but for nonlinear ones, it is inferior to the method of time-stepping by Runge-Kutta or Adams formulas. In Chebfun Version 5.1, we accordingly switched to solving IVPs numerically by ode113 (by default), converting the resulting output to a Chebfun representation.
Thanks again for the helpful comments.
dx/dt = stuff
dy/dt = stuff
OR
dt/dx = stuff
dt/dy = stuff
Require very different approaches.
This method will produce false results and not fail if the right hand side is not analytic but infinitely differentiable. It will also silently fail depending on the implementation of the automatic differentiation in the presence of integrated discontinuities anywhere in the function.
> For example, do you want to approximate some complicated integral? Just use the Stream x that we previously defined:
> ghci> erf = 0 :> exp (-x^2) > ghci> take 10 (toList erf) > [0.0,1.0,-0.0,-2.0,0.0,12.0,0.0,-120.0,0.0,1680.0]
This is not even close to the tailor series of the erf function. This to me looks more like x' = exp(-x^2) which is entirely unrelated to the integral.
The Taylor series of exp has a 1 in the zeroth coefficient, so integrating from 0 to x we get a 1 in the 1st coefficient of erf.
exp(-x^2) = 1 - x^2 + x^4/2 - x^6/6 + ...
= 1/0! - 2x^2/2! + 12x^4/4! - 120x^6/6! + ...
erf(x) = x/1! - 2x^3/3! + 12x^5/5! - 120x^7/7! + ...
Ignoring issues of convergence etc., the approach in the post can technically reach a level of precision approaching infinity. At the end of the day, this is just a neat demonstration of something which is made more elegant by infinite streams.
Edit: I see the wording in my parent comment wasn't great. I meant:
> ... but (the elegance of) this post would not have been possible without infinite streams. Pretty cool stuff.
I thought that the integration yields the area under the curve from x to a? So how does the that relate to the output of f(a + x) which is not an area quantity?
If it's f(x) = f(a) + \int_a^x f'(t)dt, then you can think of f(x) - f(a) as the area under the curve of f'(t) on the interval from a to x. For example, if f(x) = x, f'(x) = 1. The area of a function with height of 1 from a to x would be x - a, which is the same as f(x) - f(a) = x - a.
So you can try porting the other sections to executable code also, as exercises.
http://www.matematicas.unam.mx/favio/publ/cocalculus.pdf
A top hit for more info on this topic, is this 2015 HN comment thread: https://news.ycombinator.com/item?id=9617083