Class: RootSolver::BisectionNewton

Inherits:
Object
  • Object
show all
Defined in:
lib/root_solver.rb

Instance Method Summary collapse

Constructor Details

#initialize(f, low, high, tol = 0.1, n = 5) ⇒ BisectionNewton

Returns a new instance of BisectionNewton.



76
77
78
79
80
81
82
# File 'lib/root_solver.rb', line 76

def initialize(f, low, high, tol = 0.1, n = 5)
  @f    = f
  @tol  = tol
  @n    = n
  @high = high
  @low  = low
end

Instance Method Details

#solveObject



84
85
86
87
# File 'lib/root_solver.rb', line 84

def solve
  x1 = RootSolver::Bisection.new(@f, @low, @high, @tol, @n).solve
  RootSolver::Newton.new(@f, x1, @tol).solve
end