I have a very complicated pair of functions $F(x,y), G(x,y)$ that are used in a differential equation $0 = x'' + F(x,y)$, $0 =y '' + G(x,y)\,. $ $F$ and $G$ are roughly sums of products of the Bessel functions $J_n(x) J_m(y)$. In a differential equation, it is very costly to have to recompute the sum of these special functions at each step. Is there a way to make this process more efficient? I would like, for example, to precompute an interpolating function for use in NDSolve but I find NDSolve has trouble with these types of functions.
NDSolve does not have problems with interpolating functions. Not from my experience at least. Can you post an example where you run into problems?
A few other thoughts:
- Are you by any chance using
BesselJZeroin $F$ and $G$ (
BesselJZerois even slower than
- Bessel functions have other parametrizations which you could try
- Try using
- Check this question: How to improve performance of BesselJ to the level of GSL?