Skip to content

Conversation

@jverzani
Copy link
Member

cf discourse

To match Wikipedia's example:

julia> solve(ZeroProblem(x -> x^3 - x - 2, (1,2)), 
       Roots.ITP(κ₁=0.1, κ₂=2, n₀=1), 
       xatol=1e-5, xrtol=0.0, 
       verbose=true)
Results of univariate zero finding:

* Converged to: 1.5213830127326777
* Algorithm: Roots.ITP{Float64, Int64}(0.1, 2, 1)
* iterations: 6
* function evaluations ≈ 7
* stopped as x_n ≈ x_{n-1} using atol=xatol, rtol=xrtol

Trace:
(a_0, b_0) = ( 0.0000000000000000,  2.0000000000000000)
(a_1, b_1) = ( 1.0000000000000000,  2.0000000000000000)
(a_2, b_2) = ( 1.4333333333333333,  2.0000000000000000)
(a_3, b_3) = ( 1.4333333333333333,  1.5271314505696607)
(a_4, b_4) = ( 1.5200928115097818,  1.5271314505696607)
(a_5, b_5) = ( 1.5213789911605158,  1.5271314505696607)
(a_6, b_6) = ( 1.5213789911605158,  1.5213830127326777)


1.5213789911605158

@codecov
Copy link

codecov bot commented Mar 11, 2022

Codecov Report

Merging #274 (80cc4f0) into master (3956382) will increase coverage by 0.33%.
The diff coverage is 98.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #274      +/-   ##
==========================================
+ Coverage   83.82%   84.15%   +0.33%     
==========================================
  Files          12       12              
  Lines        2015     2064      +49     
==========================================
+ Hits         1689     1737      +48     
- Misses        326      327       +1     
Impacted Files Coverage Δ
src/bracketing.jl 87.98% <98.14%> (+1.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9128907...80cc4f0. Read the comment docs.


x₁₂ = (a+b)/2 # __middle(a,b)
r = ϵ2n₁₂ / 2^j - (b-a)/2
δ = κ₁ * (b - a)^κ₂
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On 1.8 this will be kind of fast if k_2 is an integer, but hard-coding k_2 to 2 would still be faster.

@KronosTheLate
Copy link
Contributor

Thank you for putting together this PR so quickly - it looks great, and I am thrilled to have my ITP implementation in such an established package <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants