diff --git a/src/nlsolve/muller.jl b/src/nlsolve/muller.jl index d1bf039..b05b5f4 100644 --- a/src/nlsolve/muller.jl +++ b/src/nlsolve/muller.jl @@ -13,6 +13,7 @@ function SciMLBase.solve(prob::NonlinearProblem, alg::SimpleMuller, args...; @assert !isinplace(prob) "`SimpleMuller` only supports OOP problems." @assert length(prob.u0) == 3 "`SimpleMuller` requires three initial guesses." xᵢ₋₂, xᵢ₋₁, xᵢ = prob.u0 + xᵢ₋₂, xᵢ₋₁, xᵢ = promote(xᵢ₋₂, xᵢ₋₁, xᵢ) @assert xᵢ₋₂ ≠ xᵢ₋₁ ≠ xᵢ ≠ xᵢ₋₂ f = Base.Fix2(prob.f, prob.p) fxᵢ₋₂, fxᵢ₋₁, fxᵢ = f(xᵢ₋₂), f(xᵢ₋₁), f(xᵢ) @@ -20,6 +21,8 @@ function SciMLBase.solve(prob::NonlinearProblem, alg::SimpleMuller, args...; abstol = __get_tolerance(nothing, abstol, promote_type(eltype(fxᵢ₋₂), eltype(xᵢ₋₂))) + xᵢ₊₁, fxᵢ₊₁ = xᵢ₋₂, fxᵢ₋₂ + for _ ∈ 1:maxiters q = (xᵢ - xᵢ₋₁)/(xᵢ₋₁ - xᵢ₋₂) A = q*fxᵢ - q*(1 + q)*fxᵢ₋₁ + q^2*fxᵢ₋₂