@@ -9,24 +9,24 @@ algorithm 4.1 because, in certain sense, the second algorithm(4.2) is an optimal
99struct Alefeld <: AbstractBracketingAlgorithm end
1010
1111function SciMLBase. solve (prob:: IntervalNonlinearProblem ,
12- alg:: Alefeld , args... ; abstol = nothing ,
13- reltol = nothing ,
14- maxiters = 1000 , kwargs... )
12+ alg:: Alefeld , args... ; abstol = nothing ,
13+ reltol = nothing ,
14+ maxiters = 1000 , kwargs... )
1515 f = Base. Fix2 (prob. f, prob. p)
1616 a, b = prob. tspan
1717 c = a - (b - a) / (f (b) - f (a)) * f (a)
1818
1919 fc = f (c)
2020 (a == c || b == c) &&
2121 return SciMLBase. build_solution (prob, alg, c, fc;
22- retcode = ReturnCode. FloatingPointLimit,
23- left = a,
24- right = b)
22+ retcode = ReturnCode. FloatingPointLimit,
23+ left = a,
24+ right = b)
2525 iszero (fc) &&
2626 return SciMLBase. build_solution (prob, alg, c, fc;
27- retcode = ReturnCode. Success,
28- left = a,
29- right = b)
27+ retcode = ReturnCode. Success,
28+ left = a,
29+ right = b)
3030 a, b, d = _bracket (f, a, b, c)
3131 e = zero (a) # Set e as 0 before iteration to avoid a non-value f(e)
3232
@@ -45,14 +45,14 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem,
4545 ē, fc = d, f (c)
4646 (a == c || b == c) &&
4747 return SciMLBase. build_solution (prob, alg, c, fc;
48- retcode = ReturnCode. FloatingPointLimit,
49- left = a,
50- right = b)
48+ retcode = ReturnCode. FloatingPointLimit,
49+ left = a,
50+ right = b)
5151 iszero (fc) &&
5252 return SciMLBase. build_solution (prob, alg, c, fc;
53- retcode = ReturnCode. Success,
54- left = a,
55- right = b)
53+ retcode = ReturnCode. Success,
54+ left = a,
55+ right = b)
5656 ā, b̄, d̄ = _bracket (f, a, b, c)
5757
5858 # The second bracketing block
@@ -68,14 +68,14 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem,
6868 fc = f (c)
6969 (ā == c || b̄ == c) &&
7070 return SciMLBase. build_solution (prob, alg, c, fc;
71- retcode = ReturnCode. FloatingPointLimit,
72- left = ā,
73- right = b̄)
71+ retcode = ReturnCode. FloatingPointLimit,
72+ left = ā,
73+ right = b̄)
7474 iszero (fc) &&
7575 return SciMLBase. build_solution (prob, alg, c, fc;
76- retcode = ReturnCode. Success,
77- left = ā,
78- right = b̄)
76+ retcode = ReturnCode. Success,
77+ left = ā,
78+ right = b̄)
7979 ā, b̄, d̄ = _bracket (f, ā, b̄, c)
8080
8181 # The third bracketing block
@@ -91,14 +91,14 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem,
9191 fc = f (c)
9292 (ā == c || b̄ == c) &&
9393 return SciMLBase. build_solution (prob, alg, c, fc;
94- retcode = ReturnCode. FloatingPointLimit,
95- left = ā,
96- right = b̄)
94+ retcode = ReturnCode. FloatingPointLimit,
95+ left = ā,
96+ right = b̄)
9797 iszero (fc) &&
9898 return SciMLBase. build_solution (prob, alg, c, fc;
99- retcode = ReturnCode. Success,
100- left = ā,
101- right = b̄)
99+ retcode = ReturnCode. Success,
100+ left = ā,
101+ right = b̄)
102102 ā, b̄, d = _bracket (f, ā, b̄, c)
103103
104104 # The last bracketing block
@@ -110,14 +110,14 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem,
110110 fc = f (c)
111111 (ā == c || b̄ == c) &&
112112 return SciMLBase. build_solution (prob, alg, c, fc;
113- retcode = ReturnCode. FloatingPointLimit,
114- left = ā,
115- right = b̄)
113+ retcode = ReturnCode. FloatingPointLimit,
114+ left = ā,
115+ right = b̄)
116116 iszero (fc) &&
117117 return SciMLBase. build_solution (prob, alg, c, fc;
118- retcode = ReturnCode. Success,
119- left = ā,
120- right = b̄)
118+ retcode = ReturnCode. Success,
119+ left = ā,
120+ right = b̄)
121121 a, b, d = _bracket (f, ā, b̄, c)
122122 end
123123 end
@@ -132,7 +132,7 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem,
132132
133133 # Reuturn solution when run out of max interation
134134 return SciMLBase. build_solution (prob, alg, c, fc; retcode = ReturnCode. MaxIters,
135- left = a, right = b)
135+ left = a, right = b)
136136end
137137
138138# Define subrotine function bracket, check fc before bracket to return solution
0 commit comments