Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
Changed name of algorithm to SimpleMuller
Browse files Browse the repository at this point in the history
  • Loading branch information
fgittins committed Apr 29, 2024
1 parent 29d63c5 commit 5ddd166
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/SimpleNonlinearSolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ end
end

export SimpleBroyden, SimpleDFSane, SimpleGaussNewton, SimpleHalley, SimpleKlement,
SimpleLimitedMemoryBroyden, SimpleNewtonRaphson, SimpleTrustRegion, Muller
SimpleLimitedMemoryBroyden, SimpleNewtonRaphson, SimpleTrustRegion, SimpleMuller
export Alefeld, Bisection, Brent, Falsi, ITP, Ridder

end # module
8 changes: 4 additions & 4 deletions src/nlsolve/muller.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""
Muller()
SimpleMuller()
Muller's method.
"""
struct Muller <: AbstractSimpleNonlinearSolveAlgorithm end
struct SimpleMuller <: AbstractSimpleNonlinearSolveAlgorithm end

function SciMLBase.solve(prob::NonlinearProblem, alg::Muller, args...;
function SciMLBase.solve(prob::NonlinearProblem, alg::SimpleMuller, args...;
abstol = nothing, maxiters = 1000, kwargs...)
@assert !isinplace(prob) "`Muller` only supports OOP problems."
@assert !isinplace(prob) "`SimpleMuller` only supports OOP problems."
xᵢ₋₂, xᵢ₋₁, xᵢ = prob.u0
@assert xᵢ₋₂ xᵢ₋₁ xᵢ xᵢ₋₂
f = Base.Fix2(prob.f, prob.p)
Expand Down
16 changes: 8 additions & 8 deletions test/core/muller_tests.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
@testitem "Muller" begin
@testitem "SimpleMuller" begin
@testset "Quadratic function" begin
f(u, p) = u^2 - p

u0 = (10, 20, 30)
p = 612
prob = NonlinearProblem{false}(f, u0, p)
sol = solve(prob, Muller())
sol = solve(prob, SimpleMuller())

@test sol.u 612

u0 = (-10, -20, -30)
prob = NonlinearProblem{false}(f, u0, p)
sol = solve(prob, Muller())
sol = solve(prob, SimpleMuller())

@test sol.u -√612
end
Expand All @@ -21,13 +21,13 @@

u0 = (1, 2, 3)
prob = NonlinearProblem{false}(f, u0)
sol = solve(prob, Muller())
sol = solve(prob, SimpleMuller())

@test sol.u π

u0 = (2, 4, 6)
prob = NonlinearProblem{false}(f, u0)
sol = solve(prob, Muller())
sol = solve(prob, SimpleMuller())

@test sol.u 2*π
end
Expand All @@ -37,19 +37,19 @@

u0 = (-2, -3, -4)
prob = NonlinearProblem{false}(f, u0)
sol = solve(prob, Muller())
sol = solve(prob, SimpleMuller())

@test sol.u -π

u0 = (-1, 0, 1/2)
prob = NonlinearProblem{false}(f, u0)
sol = solve(prob, Muller())
sol = solve(prob, SimpleMuller())

@test sol.u 0

u0 = (-1, 0, 1)
prob = NonlinearProblem{false}(f, u0)
sol = solve(prob, Muller())
sol = solve(prob, SimpleMuller())

@test sol.u π
end
Expand Down

0 comments on commit 5ddd166

Please sign in to comment.