Skip to content

Commit

Permalink
Add bisection tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dpsanders committed Feb 19, 2017
1 parent ef67920 commit 2770e21
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/root_finding/bisect.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Split the interval `X` at position α; α=0.5 corresponds to the midpoint.
Returns a tuple of the new intervals.
"""
function bisect(X::Interval, α=0.5)
m = α * X.lo + (1-α) * X.hi
m = (1-α) * X.lo + α * X.hi
return ( Interval(X.lo, m), Interval(m, X.hi) )
end

Expand Down
3 changes: 2 additions & 1 deletion src/root_finding/root_finding.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export
derivative, jacobian, # reexport derivative from ForwardDiff
Root, is_unique,
find_roots,
find_roots_midpoint
find_roots_midpoint,
bisect

import Base:

Expand Down

0 comments on commit 2770e21

Please sign in to comment.