Skip to content

Commit be30788

Browse files
Damien Courtevilledcourteville
authored andcommitted
Test internal rootfinder on trickier problem
1 parent b243184 commit be30788

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/internal_rootfinder.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,14 @@ for Rootfinder in (InternalITP,)
3636
@test abs.(solve(inp3, rf).u) sqrt.(p)
3737
@test abs.(solve(inp4, rf).u) sqrt.(p)
3838
end
39+
40+
# https://github.com/SciML/DifferentialEquations.jl/issues/1087
41+
# Test with normal and reversed tspan.
42+
# The expected zero is -acos(p), but there is another zero at acos(p) just outside tspan
43+
f(u, p) = cos(u) - p
44+
p = 0.9
45+
inp1 = IntervalNonlinearProblem(f, (-1.1 * acos(p), 0.9 * acos(p)), p)
46+
inp2 = IntervalNonlinearProblem(f, (0.9 * acos(p), -1.1 * acos(p)), p)
47+
@test solve(inp1, rf).u -acos(p)
48+
@test solve(inp2, rf).u -acos(p)
3949
end

0 commit comments

Comments
 (0)