# Is there a julia package that uses Newton-Krylov method for systems of nonlinear equations?

**URL:** <https://discourse.julialang.org/t/is-there-a-julia-package-that-uses-newton-krylov-method-for-systems-of-nonlinear-equations/36520>\
**Category:** General Usage\
**Created:** [March 25, 2020, 9:25pm UTC](https://discourse.julialang.org/t/is-there-a-julia-package-that-uses-newton-krylov-method-for-systems-of-nonlinear-equations/36520 "2020-03-25T21:25:20Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [March 29, 2020, 5:46pm UTC](https://discourse.julialang.org/t/is-there-a-julia-package-that-uses-newton-krylov-method-for-systems-of-nonlinear-equations/36520/21 "2020-03-29T17:46:50Z")

</div>

> [@rveltz](#):
>
> The closest I can think of are methods for the computation of periodic orbits as BVP. I do not use the solvers of DE for that, except for the shooting algorithm where I call DE. These BVPs are quite specific (you have to add a constraint otherwise they are not well posed) so that’s why I dont call DE. I also use a lot of tricks to make the computation faster and the solvers are optimized for large scale problems. When the periodic orbit has a large period (close to homoclinic point), the methods show their weaknesses.

What are the interesting features of this BVP? It would probably be a good thing to have BVP solvers that specialize on this if it comes up a lot.

---

<div class="post-metadata">

**Author:** ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Post date:** [March 29, 2020, 6:02pm UTC](https://discourse.julialang.org/t/is-there-a-julia-package-that-uses-newton-krylov-method-for-systems-of-nonlinear-equations/36520/22 "2020-03-29T18:02:35Z")

</div>

There are like constrained BVP. You have to add a constraint to fix the phase of the periodic orbit (PO). This is explained [here](https://rveltz.github.io/PseudoArcLengthContinuation.jl/dev/periodicOrbit/); [here](https://rveltz.github.io/PseudoArcLengthContinuation.jl/dev/periodicOrbitFD/) for the FD method, for the shooting [here](https://rveltz.github.io/PseudoArcLengthContinuation.jl/dev/periodicOrbitShooting/).

I tend to think that this is quite specific to the problem of computing PO but I may be wrong.

The standard shooting method (one of the methods [here](https://rveltz.github.io/PseudoArcLengthContinuation.jl/dev/periodicOrbitShooting/)) is straightforward to implement using DE but useless if you cant pass a preconditionner.

In fact, the "only’’ difficulty for computing PO in large dimensions (with FD methods or Shooting ones) is to be able to invert cyclic-by blocks linear systems like [those](https://rveltz.github.io/PseudoArcLengthContinuation.jl/dev/periodicOrbitFD/) and they are **notoriously difficult** to solve in general. It is the main reason why computing PO in large dimensions is difficult.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [March 29, 2020, 6:16pm UTC](https://discourse.julialang.org/t/is-there-a-julia-package-that-uses-newton-krylov-method-for-systems-of-nonlinear-equations/36520/23 "2020-03-29T18:16:49Z")

</div>

> [@rveltz](#):
>
> There are like constrained BVP. You have to add a constraint to fix the phase of the periodic orbit (PO).
> 
> I tend to think that this is quite specific to the problem of computing PO but I may be wrong.

Ahh yeah, it’s a Boundary Value Differential-Algebraic Equation. I plan to get around to those, but indeed doing the general form in a very good way is fairly involved. The generalization of that finite difference type of method is the MIRK tableau form, but we need to work on adaptivity and stuff there. One of the things that was holding back this work though was that I didn’t get enough requests/interest from users about BVPs, but now that there’s a clear use case it’ll get a priority bump. Still probably a year or two away from something you’d really want to see though, but maybe we can collaborate a bit here. Though indeed, this is the kind of thing where it’ll need to specialize on a bunch of matrix forms and such in order to be good, which is exactly why it would take a bunch of work.

---

<div class="post-metadata">

**Author:** ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Post date:** [March 29, 2020, 6:36pm UTC](https://discourse.julialang.org/t/is-there-a-julia-package-that-uses-newton-krylov-method-for-systems-of-nonlinear-equations/36520/24 "2020-03-29T18:36:28Z")

</div>

> [@ChrisRackauckas](#):
>
> The generalization of that finite difference type of method is the MIRK tableau form,

The reason for the use of FD method is because the linear system is not too filled in and we can precondition it. Otherwise, I have no clue if it is possible.

One thing FD lacks is mesh adaptation, that’s a big thing if the PO has large period or a strange structure. I’ll have a look a the bvp mirk4 method.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [March 29, 2020, 6:58pm UTC](https://discourse.julialang.org/t/is-there-a-julia-package-that-uses-newton-krylov-method-for-systems-of-nonlinear-equations/36520/25 "2020-03-29T18:58:14Z")

</div>

> [@rveltz](#):
>
> The reason for the use of FD method is because the linear system is not too filled in and we can precondition it. Otherwise, I have no clue if it is possible.

Yes, we need to add a way to do preconditioning on it. Though IIRC a two-point BVP gets you a banded matrix? So if it’s a two-point BVP then you want to do a banded direct solver for sure, and then if you have different conditions you fallback to generic linear solver methods with preconditioners and all of that, and that’s what we haven’t exposed well in our BVP solvers.

---

<div class="post-metadata">

**Author:** ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Post date:** [March 29, 2020, 9:26pm UTC](https://discourse.julialang.org/t/is-there-a-julia-package-that-uses-newton-krylov-method-for-systems-of-nonlinear-equations/36520/26 "2020-03-29T21:26:36Z")

</div>

Not for PO. The boundary condition x(0) = x(1) makes the jacobian cyclic and not banded. That’s where the difficulty lies.

---

<div class="post-metadata">

**Author:** ![AP9](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ap9/32/212443_2.png) [@AP9](https://discourse.julialang.org/u/AP9)\
**Post date:** [April 11, 2025, 1:39pm UTC](https://discourse.julialang.org/t/is-there-a-julia-package-that-uses-newton-krylov-method-for-systems-of-nonlinear-equations/36520/27 "2025-04-11T13:39:23Z")

</div>

Hi, I am interested in the examples mentioned here. Where can I find the resources linked? Thank you.

---

<div class="post-metadata">

**Author:** ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Post date:** [April 11, 2025, 1:42pm UTC](https://discourse.julialang.org/t/is-there-a-julia-package-that-uses-newton-krylov-method-for-systems-of-nonlinear-equations/36520/28 "2025-04-11T13:42:53Z")

</div>

In BifurcationKit.jl

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [April 12, 2025, 11:40am UTC](https://discourse.julialang.org/t/is-there-a-julia-package-that-uses-newton-krylov-method-for-systems-of-nonlinear-equations/36520/29 "2025-04-12T11:40:28Z")

</div>

Since this thread has come alive, I should mention NonlinearSolve.jl has Jacobian-Free Newton Krylov methods and we’d recommend using that over NLsolve.jl these days. All of SciML has switched over. Copious amounts of details are in:

> **[NonlinearSolve.jl: High-Performance and Robust Solvers for Systems of...](https://arxiv.org/abs/2403.16341)**
>
> Efficiently solving nonlinear equations underpins numerous scientific and engineering disciplines, yet scaling these solutions for complex system models remains a challenge. This paper presents NonlinearSolve.jl - a suite of high-performance...

[Previous page](https://discourse.julialang.org/t/is-there-a-julia-package-that-uses-newton-krylov-method-for-systems-of-nonlinear-equations/36520.md?page=1)
