This function solves a system of non-linear equations using the Jacobian-Free Newton-Krylov (JFNK) method. The main advantage of using JFNK over the traditional Newton method is to avoid the need for generating and inverting the Jacobian matrix. Typically the Jacobian matrix is not analytically attainable and its numerical approximation (e.g., via finite-difference methods) is not easily invertible.
Reference: (1) Knoll D.A., Keyes D.E. "Jacobian-Free Newton-Krylov methods: a survey of approaches and applications", Journal of Computational Physics, August 2003.
Cheuk (2020). Jacobian-Free Newton-Krylov (JFNK) method (https://www.mathworks.com/matlabcentral/fileexchange/45170-jacobian-free-newton-krylov-jfnk-method), MATLAB Central File Exchange. Retrieved .
Hi, is there an example/manual how to apply this method for someone who is not very knowledgeable in MATLAB?
Thank you for reminding me that the built-in gmres can accept a function handle. It is heuristic! :)
It is very nice for illustrating the JFNK methods. However, in my opinion, it still has to be optimized. For example:
1) The GMRES is called without any preconditioning. That makes its convergence very slow.
2) For a fixed Newton iteration (e.g., fixed x), for each Krylov iteration, the function that computes Jv (JV_APPROX) evaluates both f(x) and f(x+epsilon*v). However, f(x) is always the same in that iterations! That should be taken into account to reduce computational cost, especially if f is expensive to compute ---in that case, computational cost could be reduced almost to the half part---.
3) The variable pert (in JV_APPROX) should be computed avoiding loops.
Thank you Cheuk,thank to you. I would like to learn about JFNK.
Coz I'm using Octave, not MATLAB
function gmres not included. :(