Skip to content

IntervalArithmeticPlayground

Documentation for IntervalArithmeticPlayground.

Root Finding

rootfinding_with_bisection は二分法を用いて与えられた関数の根を求める関数です。 根が存在する区間の候補のリストを返します。

julia
using IntervalArithmetic, IntervalArithmeticPlayground

f(x) = (x - 1) * (x - 2) * (x - 3)

rootfinding_with_bisection(f, interval(0, 3.5), maxiter=6)
3-element Vector{IntervalArithmetic.Interval{Float64}}:
 [0.984375, 1.03906]_com
 [1.96875, 2.02344]_com
 [2.95312, 3.00781]_com

src/example/rootfinding.jl にある plot_roots 関数を使うことで次のような図を描くこともできます。