# \#nonlinearsolve

**URL:** https://discourse.julialang.org/tag/nonlinearsolve/921.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [An unexpected clash between NonlinearSolve and ForwardDiff](https://discourse.julialang.org/t/an-unexpected-clash-between-nonlinearsolve-and-forwarddiff/137034)

<div class="topic-metadata">

**Author:** [@ij05](https://discourse.julialang.org/u/ij05)\
**Replies:** 2\
**Last updated:** [May 8, 2026, 12:36pm UTC](https://discourse.julialang.org/t/an-unexpected-clash-between-nonlinearsolve-and-forwarddiff/137034 "2026-05-08T12:36:52Z")

</div>

Hello, I was successfully using the following block of code which uses ForwardDiff.gradient on a function, that has a Nonlinearsolve.NonlinearLeastSquaresProblem. It was giving out correct gradients (and jacobians) unti…

---

## [Solving system of spatial Ordinary Differential Equations](https://discourse.julialang.org/t/solving-system-of-spatial-ordinary-differential-equations/135007)

<div class="topic-metadata">

**Author:** [@federicoangioni](https://discourse.julialang.org/u/federicoangioni)\
**Replies:** 1\
**Last updated:** [January 21, 2026, 4:26am UTC](https://discourse.julialang.org/t/solving-system-of-spatial-ordinary-differential-equations/135007 "2026-01-21T04:26:33Z")

</div>

Hello all, I am Federico, and an undergraduate student approaching Julia for the first time as a part of my studies in computational science. I am currently struggling with solving a system of coupled Ordinary Different…

---

## [NonlinearSolve.jl : mimic SimpleNewtonRaphson with NewtonRaphson](https://discourse.julialang.org/t/nonlinearsolve-jl-mimic-simplenewtonraphson-with-newtonraphson/134280)

<div class="topic-metadata">

**Author:** [@bmxam](https://discourse.julialang.org/u/bmxam)\
**Replies:** 5\
**Last updated:** [December 5, 2025, 2:50pm UTC](https://discourse.julialang.org/t/nonlinearsolve-jl-mimic-simplenewtonraphson-with-newtonraphson/134280 "2025-12-05T14:50:57Z")

</div>

Hi everyone, I’m trying to solve a non-linear equation using a Newton-Raphson method using NonlinearSolve.jl . I have my own implementation of a basic Newton-Raphson algorithm, and the SimpleNewtonRaphson algorithm does…

---

## [Is \`callback\` really compatible with NonlinearProblem?](https://discourse.julialang.org/t/is-callback-really-compatible-with-nonlinearproblem/134332)

<div class="topic-metadata">

**Author:** [@bmxam](https://discourse.julialang.org/u/bmxam)\
**Replies:** 4\
**Last updated:** [December 5, 2025, 12:07pm UTC](https://discourse.julialang.org/t/is-callback-really-compatible-with-nonlinearproblem/134332 "2025-12-05T12:07:45Z")

</div>

Hi everyone, According to the documentation (Nonlinear Problems · NonlinearSolve.jl), “if you set a callback in the problem, then that callback will be added in every solve call”. So I tried to add a callback but nothin…

---

## [How to reinit NonlinearSolve.jl problem/integrator?](https://discourse.julialang.org/t/how-to-reinit-nonlinearsolve-jl-problem-integrator/109536)

<div class="topic-metadata">

**Author:** [@jamblejoe](https://discourse.julialang.org/u/jamblejoe)\
**Replies:** 5\
**Last updated:** [November 5, 2025, 11:47pm UTC](https://discourse.julialang.org/t/how-to-reinit-nonlinearsolve-jl-problem-integrator/109536 "2025-11-05T23:47:14Z")

</div>

Consider f(u, p) = u .\* u .- p u0 = @SVector\[1.0, 1.0\] prob = NonlinearProblem(f, u0, \[1\]) solver = solve(prob) How do I reinitialize the problem or the underlying integrator/cache with new u0 and p?

---

## [NonlinearSolve.jl - multidimensional interval root finding](https://discourse.julialang.org/t/nonlinearsolve-jl-multidimensional-interval-root-finding/132919)

<div class="topic-metadata">

**Author:** [@Longblackcoffee](https://discourse.julialang.org/u/Longblackcoffee)\
**Replies:** 4\
**Last updated:** [October 16, 2025, 1:45pm UTC](https://discourse.julialang.org/t/nonlinearsolve-jl-multidimensional-interval-root-finding/132919 "2025-10-16T13:45:07Z")

</div>

Hi everyone, TLDR: Is there a way to do multi-dimensional interval root-finding with NonlinearSolve.jl? From my understanding, it only supports one-dimensional interval root-finding right now, so I was wondering whether…

---

## [Error when specifying trace level with NonlinearSolve.jl](https://discourse.julialang.org/t/error-when-specifying-trace-level-with-nonlinearsolve-jl/132844)

<div class="topic-metadata">

**Author:** [@rpetit](https://discourse.julialang.org/u/rpetit)\
**Replies:** 3\
**Last updated:** [October 5, 2025, 3:17am UTC](https://discourse.julialang.org/t/error-when-specifying-trace-level-with-nonlinearsolve-jl/132844 "2025-10-05T03:17:37Z")

</div>

Hi, I got an error with NonlinearSolve.jl v4.12.0 when specifying a trace level different than TraceMinimal(). The following code is taken from the diagnostics API page of the documentation. using NonlinearSolve funct…

---

## [Something is broken, perhaps NonlinearSolve?](https://discourse.julialang.org/t/something-is-broken-perhaps-nonlinearsolve/132483)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 4\
**Last updated:** [September 18, 2025, 4:13pm UTC](https://discourse.julialang.org/t/something-is-broken-perhaps-nonlinearsolve/132483 "2025-09-18T16:13:36Z")

</div>

Since two days something is broken: Info Packages marked with ⌃ and ⌅ have new versions available. Those with ⌃ may be upgradable, but those with ⌅ are restricted by compatibility constraints from upgrading. To …

---

## [ForwardDiff.jl Jacobian with NonlinearSolve.jl](https://discourse.julialang.org/t/forwarddiff-jl-jacobian-with-nonlinearsolve-jl/132353)

<div class="topic-metadata">

**Author:** [@Jskacines](https://discourse.julialang.org/u/Jskacines)\
**Replies:** 1\
**Last updated:** [September 13, 2025, 5:39pm UTC](https://discourse.julialang.org/t/forwarddiff-jl-jacobian-with-nonlinearsolve-jl/132353 "2025-09-13T17:39:14Z")

</div>

Hello, I am new to Julia, so let me know if i’m missing any basics. I am using NonlinearSolve.jl to solve a nonlinear system, and I wish to take the jacobian of this solution with respect to input parameters. The code …

---

## [NonlinearSolve.jl: Possible to store solution in-place of initial guess?](https://discourse.julialang.org/t/nonlinearsolve-jl-possible-to-store-solution-in-place-of-initial-guess/131208)

<div class="topic-metadata">

**Author:** [@DanDoe](https://discourse.julialang.org/u/DanDoe)\
**Replies:** 16\
**Last updated:** [August 19, 2025, 7:23am UTC](https://discourse.julialang.org/t/nonlinearsolve-jl-possible-to-store-solution-in-place-of-initial-guess/131208 "2025-08-19T07:23:49Z")

</div>

The standard workfllow to access the solution of a nonlinear\_eq = NonlinearProblem is something like sol = SciMLBase.solve(nonlinear\_eq, NewtonRaphson(autodiff = AutoFiniteDiff())); Is it possible to suppress the build…

---

## [Using the result of NonlinearSolve.jl allocates memory](https://discourse.julialang.org/t/using-the-result-of-nonlinearsolve-jl-allocates-memory/131242)

<div class="topic-metadata">

**Author:** [@Gako](https://discourse.julialang.org/u/Gako)\
**Replies:** 3\
**Last updated:** [July 31, 2025, 10:41am UTC](https://discourse.julialang.org/t/using-the-result-of-nonlinearsolve-jl-allocates-memory/131242 "2025-07-31T10:41:09Z")

</div>

I’m using the following code to try and understand how broadcasting and allocation work in Julia: using NonlinearSolve function nonlin() nonlinprob(x, p) = return x - 3 prob = NonlinearProblem(nonlinprob, 2.) …

---

## [Best practices for use of structs with NonlinearSolve.jl](https://discourse.julialang.org/t/best-practices-for-use-of-structs-with-nonlinearsolve-jl/130286)

<div class="topic-metadata">

**Author:** [@PatrickMcFarlane](https://discourse.julialang.org/u/PatrickMcFarlane)\
**Replies:** 15\
**Last updated:** [July 2, 2025, 2:36pm UTC](https://discourse.julialang.org/t/best-practices-for-use-of-structs-with-nonlinearsolve-jl/130286 "2025-07-02T14:36:25Z")

</div>

I’m working on an economic model where I need to solve a system of equations. Most of those equations are defined implicitly from a sort of mean-field game. Basically I construct several multidimensional arrays, const…

---

## [Rank-deficient jacobian error in Newton-Raphson method for unstable limit cycle refinement](https://discourse.julialang.org/t/rank-deficient-jacobian-error-in-newton-raphson-method-for-unstable-limit-cycle-refinement/129975)

<div class="topic-metadata">

**Author:** [@R.Kanakov](https://discourse.julialang.org/u/R.Kanakov)\
**Replies:** 3\
**Last updated:** [June 17, 2025, 10:20pm UTC](https://discourse.julialang.org/t/rank-deficient-jacobian-error-in-newton-raphson-method-for-unstable-limit-cycle-refinement/129975 "2025-06-17T22:20:57Z")

</div>

I am trying to refine the position of an unstable limit cycle within a chaotic attractor using the Newton-Raphson method, but I am running into a confusing error related to a rank-deficient matrix. To avoid degeneracy o…

---

## [How to resolve a nonlinear equations system in GPU (parallel)](https://discourse.julialang.org/t/how-to-resolve-a-nonlinear-equations-system-in-gpu-parallel/118226)

<div class="topic-metadata">

**Author:** [@Juan\_jose](https://discourse.julialang.org/u/Juan_jose)\
**Replies:** 4\
**Last updated:** [May 29, 2025, 12:05am UTC](https://discourse.julialang.org/t/how-to-resolve-a-nonlinear-equations-system-in-gpu-parallel/118226 "2025-05-29T00:05:20Z")

</div>

Hello, I’m new using Julia and I’m trying to solve a large system of nonlinear equations (\>768 equations, \>200 unknowns). I was reading the documentation for NonlinearSolve.jl, and although it mentioned that for solvers …

---

## [NonlinearSolve.jl with Sparse Jacobian: J isn't square?!](https://discourse.julialang.org/t/nonlinearsolve-jl-with-sparse-jacobian-j-isnt-square/128768)

<div class="topic-metadata">

**Author:** [@luke-kiernan](https://discourse.julialang.org/u/luke-kiernan)\
**Replies:** 0\
**Last updated:** [May 6, 2025, 8:22pm UTC](https://discourse.julialang.org/t/nonlinearsolve-jl-with-sparse-jacobian-j-isnt-square/128768 "2025-05-06T20:22:15Z")

</div>

I’m trying to use NonlinearSolve.jl’s LevenbergMarquardt solver on a powerflow. The solve call yields an error: LoadError: ArgumentError: KLU only accepts square matrices. That seems nonsensical: J0 is square. I expect t…

---

## [Initial guess for array-valued variables not passed to NonlinearProblem](https://discourse.julialang.org/t/initial-guess-for-array-valued-variables-not-passed-to-nonlinearproblem/128372)

<div class="topic-metadata">

**Author:** [@sass-jacob](https://discourse.julialang.org/u/sass-jacob)\
**Replies:** 1\
**Last updated:** [April 25, 2025, 11:07am UTC](https://discourse.julialang.org/t/initial-guess-for-array-valued-variables-not-passed-to-nonlinearproblem/128372 "2025-04-25T11:07:35Z")

</div>

I have created a MWE in which it seems the initial guess for array-valued variables set as irreducible is not passed to NonlinearProblem. Please advise if there is an alternative way to do this or if an issue should be p…

---

## [SciML to solve compound interest equation](https://discourse.julialang.org/t/sciml-to-solve-compound-interest-equation/106387)

<div class="topic-metadata">

**Author:** [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Replies:** 5\
**Last updated:** [April 7, 2025, 5:15pm UTC](https://discourse.julialang.org/t/sciml-to-solve-compound-interest-equation/106387 "2025-04-07T17:15:17Z")

</div>

I just went through the SciML tutorials and now am trying to apply them by building a calculator for solving the compound interest equation. I have two working implementations, but neither seems very convenient. What is …

---

## [Solving nonlinear equations using dual numbers](https://discourse.julialang.org/t/solving-nonlinear-equations-using-dual-numbers/126967)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 16\
**Last updated:** [March 16, 2025, 12:56pm UTC](https://discourse.julialang.org/t/solving-nonlinear-equations-using-dual-numbers/126967 "2025-03-16T12:56:54Z")

</div>

How can I use automated differentiation with NonlinearSolve? I thought it is sufficient to use initial values that are dual numbers. This is not working: if DUAL state\_vec = ForwardDiff.Dual\[Dual(state\_vec\[1\]), Dua…

---

## [How to solve a nonlinear problem](https://discourse.julialang.org/t/how-to-solve-a-nonlinear-problem/126877)

<div class="topic-metadata">

**Author:** [@andrea\_bertozzi](https://discourse.julialang.org/u/andrea_bertozzi)\
**Replies:** 5\
**Last updated:** [March 13, 2025, 9:27am UTC](https://discourse.julialang.org/t/how-to-solve-a-nonlinear-problem/126877 "2025-03-13T09:27:41Z")

</div>

I have the following code and I am trying to solve a nonlinear problem using MAT using NonlinearSolve using FiniteDifferences include("../src/Tether\_quasistatic.jl") function get\_init\_cond(filename) vars = matread(…

---

## [Dynamic plotting of NonlinearSolve controlled by sliders in Makie](https://discourse.julialang.org/t/dynamic-plotting-of-nonlinearsolve-controlled-by-sliders-in-makie/126737)

<div class="topic-metadata">

**Author:** [@Mehdi\_MABED](https://discourse.julialang.org/u/Mehdi_MABED)\
**Replies:** 1\
**Last updated:** [March 10, 2025, 12:12am UTC](https://discourse.julialang.org/t/dynamic-plotting-of-nonlinearsolve-controlled-by-sliders-in-makie/126737 "2025-03-10T00:12:07Z")

</div>

I want to solve a non linear problem which depend on 3 variables, each one of them being controlled by a slider in Makie and I struggle with that. My non linear function takes an input number (the x coordinate) with 3 p…

---

## [Terminate Nonlinearsolve when residual does not decrease](https://discourse.julialang.org/t/terminate-nonlinearsolve-when-residual-does-not-decrease/125732)

<div class="topic-metadata">

**Author:** [@pavaninguva](https://discourse.julialang.org/u/pavaninguva)\
**Replies:** 4\
**Last updated:** [February 13, 2025, 11:45pm UTC](https://discourse.julialang.org/t/terminate-nonlinearsolve-when-residual-does-not-decrease/125732 "2025-02-13T23:45:39Z")

</div>

Hi! I am trying to terminate the solution of a nonlinear equation system when the residual does not decrease with successive iterations. I have tried two approaches: Trying to access the residuals during each iteratio…

---

## [Receiving the Error: "MethodError: no method matching eps(::Int64)" When Using NonlinearProblem Solver](https://discourse.julialang.org/t/receiving-the-error-methoderror-no-method-matching-eps-int64-when-using-nonlinearproblem-solver/125514)

<div class="topic-metadata">

**Author:** [@mcket747](https://discourse.julialang.org/u/mcket747)\
**Replies:** 8\
**Last updated:** [February 6, 2025, 9:43pm UTC](https://discourse.julialang.org/t/receiving-the-error-methoderror-no-method-matching-eps-int64-when-using-nonlinearproblem-solver/125514 "2025-02-06T21:43:24Z")

</div>

Hello, I am attempting to solve a non-linear optimization problem using the NonlinearProblem solver with the TrustRegion method. I kept getting the error saying there was no method for Float64(::ForwardDiff Dual etc). I …

---

## [Getting to zero allocations in NonlinearSolve.jl](https://discourse.julialang.org/t/getting-to-zero-allocations-in-nonlinearsolve-jl/123123)

<div class="topic-metadata">

**Author:** [@rafaelbailo](https://discourse.julialang.org/u/rafaelbailo)\
**Replies:** 9\
**Last updated:** [November 29, 2024, 6:05am UTC](https://discourse.julialang.org/t/getting-to-zero-allocations-in-nonlinearsolve-jl/123123 "2024-11-29T06:05:30Z")

</div>

I am in the process of migrating some code from NLsolve.jl to NonlinearSolve.jl. I have written a simple Newton-Raphson test, but I cannot get the allocations down to zero; both solve! and reinit! allocate. Can this be i…

---

## [NonlinearSolve uses AD Jacobian even when I specify it analytically](https://discourse.julialang.org/t/nonlinearsolve-uses-ad-jacobian-even-when-i-specify-it-analytically/122608)

<div class="topic-metadata">

**Author:** [@DanDoe](https://discourse.julialang.org/u/DanDoe)\
**Replies:** 3\
**Last updated:** [November 14, 2024, 3:32pm UTC](https://discourse.julialang.org/t/nonlinearsolve-uses-ad-jacobian-even-when-i-specify-it-analytically/122608 "2024-11-14T15:32:20Z")

</div>

Hm, I recently tried specification of the Jacobian in this way - however, NonlinearSolve still tries to attempt to construct the Jacobian using AD. Has anything changed here?

---

## [Newton + LineSearch in Hot Loop: Reduce allocations](https://discourse.julialang.org/t/newton-linesearch-in-hot-loop-reduce-allocations/122585)

<div class="topic-metadata">

**Author:** [@DanDoe](https://discourse.julialang.org/u/DanDoe)\
**Replies:** 6\
**Last updated:** [November 14, 2024, 8:08am UTC](https://discourse.julialang.org/t/newton-linesearch-in-hot-loop-reduce-allocations/122585 "2024-11-14T08:08:18Z")

</div>

I really like the NLsolve.jl package in conjunction with LineSearches.jl - great stuff! I have a scalar, relatively simple nonlinear equation that I can solve using res = nlsolve(gamma -\> f(gamma\[1\], bla, bla, bla), …

---

## [Specifying analytical jacobian in NonlinearProblem](https://discourse.julialang.org/t/specifying-analytical-jacobian-in-nonlinearproblem/112932)

<div class="topic-metadata">

**Author:** [@askprash](https://discourse.julialang.org/u/askprash)\
**Replies:** 2\
**Last updated:** [April 14, 2024, 8:14pm UTC](https://discourse.julialang.org/t/specifying-analytical-jacobian-in-nonlinearproblem/112932 "2024-04-14T20:14:54Z")

</div>

Hi! I’m new to using NonlinearSolve.jl and trying to understand how to provide an analytical jacobian to the problem. I realize that this is unnecessary if we have autodiff in the mix since that will be enough - but in c…

---

## [Enforce positivity in simple PDE solution](https://discourse.julialang.org/t/enforce-positivity-in-simple-pde-solution/121738)

<div class="topic-metadata">

**Author:** [@ify](https://discourse.julialang.org/u/ify)\
**Replies:** 5\
**Last updated:** [October 28, 2024, 10:35am UTC](https://discourse.julialang.org/t/enforce-positivity-in-simple-pde-solution/121738 "2024-10-28T10:35:57Z")

</div>

Hi all, Pretty new to julia. I am trying to solve a simplified PDE that I normally would do in R. In R, the numerical steady state solution can be constrained to obtain solution concentration. However, when I translate …

---

## [Using NonlinearSolve with autodiff](https://discourse.julialang.org/t/using-nonlinearsolve-with-autodiff/121333)

<div class="topic-metadata">

**Author:** [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Replies:** 9\
**Last updated:** [October 17, 2024, 9:18pm UTC](https://discourse.julialang.org/t/using-nonlinearsolve-with-autodiff/121333 "2024-10-17T21:18:38Z")

</div>

Hello, I was trying to test NonlinearSolve.jl with automatic differentiation like Enzyme.jl or Zygote.jl. But the following simple code fails f(x, p) = p.a \* x^2 - p.b prob = NonlinearProblem(f, 0.0, (a=1.0, b=2.0)) so…

---

## [Simple Model using ModelingToolkit and Clapeyron failing](https://discourse.julialang.org/t/simple-model-using-modelingtoolkit-and-clapeyron-failing/120874)

<div class="topic-metadata">

**Author:** [@JarodMcCormick](https://discourse.julialang.org/u/JarodMcCormick)\
**Replies:** 5\
**Last updated:** [October 7, 2024, 11:57pm UTC](https://discourse.julialang.org/t/simple-model-using-modelingtoolkit-and-clapeyron-failing/120874 "2024-10-07T23:57:01Z")

</div>

I’ve been working on implementing some simple models utilizing both ModelingToolkit and Clapeyron. I put together this simple model of a generic compressor: using ModelingToolkit, NonlinearSolve using Clapeyron model =…

---

## [Best practices for NonlinearSolve definition with temporary arrays](https://discourse.julialang.org/t/best-practices-for-nonlinearsolve-definition-with-temporary-arrays/115763)

<div class="topic-metadata">

**Author:** [@dieg0](https://discourse.julialang.org/u/dieg0)\
**Replies:** 6\
**Last updated:** [October 7, 2024, 1:01pm UTC](https://discourse.julialang.org/t/best-practices-for-nonlinearsolve-definition-with-temporary-arrays/115763 "2024-10-07T13:01:48Z")

</div>

Hi all, I am relatively new to Julia. Apologies as it’s a long one but I couldn’t find a solution. I am using NonlinearSolve.jl to solve a somewhat “complicated” system of equations g(u, p) = 0. The reason the function …

[Next page](https://discourse.julialang.org/tag/nonlinearsolve/921.md?match_all_tags=true&page=1&tags%5B%5D=nonlinearsolve)
