News for hackers. Stuff that matters.
Re:A lazy way to solve differential equations by johnbcoughlin on Friday July 22, 2022 @10:17AM (#32192077)
The post describes essentially a spectral method for solving ODEs in the Taylor (monomial) basis. Haskell definitely makes it nice to play around with this, but the monomial basis is terribly ill conditioned and not a good choice for this application. The Chebyshev basis is much better. Anyone who finds this neat, I recommend checking out the chebfun family of packages. They use the same idea but with much more rigorous numerics.
Re:A lazy way to solve differential equations by jamessb on Friday July 22, 2022 @10:50AM (#32192454)
> I recommend checking out the chebfun family of packages.

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].

[1]: https://people.maths.ox.ac.uk/trefethen/ExplODE/

[2]: https://www.chebfun.org/

[3]: https://www.chebfun.org/about/projects.html

Re:A lazy way to solve differential equations by ChrisRackauckas on Friday July 22, 2022 @11:24AM (#32192967)
> The Chebyshev basis is much better

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.

Re:A lazy way to solve differential equations by mturmon on Friday July 22, 2022 @02:58PM (#32195816)
This comment and GP comment open up a helpful learning experience for a casual/occasional user like me.

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.

Re:A lazy way to solve differential equations by naillo on Friday July 22, 2022 @12:01PM (#32193504)
Anyone here (or the OP) know how you'd use chebyshev in a multivariate scenario? The wikipedia article only defines them for the 1d case.
Re:A lazy way to solve differential equations by bigbillheck on Friday July 22, 2022 @02:37PM (#32195572)
Re:A lazy way to solve differential equations by freemint on Friday July 22, 2022 @12:07PM (#32193585)
What exactly do you mean by multivariate?
Re:A lazy way to solve differential equations by naillo on Friday July 22, 2022 @12:22PM (#32193793)
More than one variable :) x/y/z etc
Re:A lazy way to solve differential equations by freemint on Friday July 22, 2022 @12:25PM (#32193830)
There are two ways differential equations can involve more than one variable.

dx/dt = stuff

dy/dt = stuff

OR

dt/dx = stuff

dt/dy = stuff

Require very different approaches.

Re:A lazy way to solve differential equations by naillo on Friday July 22, 2022 @12:43PM (#32194064)
I wasn't actually gonna use them to solve a diff equation though to be honest :) I was just experimenting with denoising diffusion and instead of a u-net to infer the denoising step, I was thinking about using a multivariate polynomial. (Since if you express the output denoising as a linear combination of polynomials finding the denoiser just turns into linear algebra. Might be a big solve etc but inferene is way fast and it's nice to know that you have the global opimum.) I'm sitting at the code right this instant and was using x, y, xy, x^2y, xy^2, etc, but this thread inspired me to try out chebychev as a possible alternative. :)
Re:A lazy way to solve differential equations by johnbcoughlin on Friday July 22, 2022 @01:20PM (#32194546)
Any orthogonal polynomial family can be combined into a simple tensor product basis. So in your case you could try T_1(x), T_1(y), T_1(x)T_1(y), T_2(x), T_2(x)T_1(y), and so on.
Re:A lazy way to solve differential equations by wheelinsupial on Friday July 22, 2022 @12:41PM (#32194028)
I think they might be asking about PDEs instead of ODEs in this case when they mentioned x, y, z as being multivariable.