1.3. Root_Finding module

Root_Finding.bisection(func, interval, tol, maxiter=100, sol=None)

This function finds the roots of the given function using Bisection method

Parameters
  • func (function) – function name whose root is to be found

  • interval (tuple) – a two tuple of endpoints

  • tol (float) – tolerance limit within which the root is to be found

  • maxiter (int, optional) – maximum number of the iterations allowed. Default is 100

  • sol (int, optinal) – Actual expected root. Default is None

Returns

  • root (float) – computed root of the function

  • iteration (int) – number of iterations used to arrive at the root

Root_Finding.newton(func, dfunc, initial, tol, maxiter=100)

This function finds the roots of the given function using Newton-Raphson method

Parameters
  • func (function) – function name whose root is to be found

  • dfunc (function) – derivative of the function

  • initial (tuple) – starting point(two tuple) for finding the root

  • tol (float) – tolerance limit within which the root is to be found

  • maxiter (int, optional) – maximum number of the iterations allowed. Default is 100

Returns

  • root (float) – computed root of the function

  • iteration (int) – number of iterations used to arrive at the root

Root_Finding.regula_falsi(func, interval, tol, maxiter=100, sol=None)

This function finds the roots of the given function using Regula-Falsi method

Parameters
  • func (function) – function name whose root is to be found

  • interval (tuple) – a tuple of endpoints

  • tol (float) – tolerance limit within which the root is to be found

  • maxiter (int, optional) – maximum number of the iterations allowed. Default is 100.

  • sol (int, optional) – value of the actual solution in the interval. Default is None.

Returns

  • root (float) – computed root of the function

  • iteration (int) – number of iterations used to arrive at the root

Root_Finding.secant(func, interval, tol, maxiter=100)

This function finds the roots of the given function using secant method

Parameters
  • func (function) – function name whose root is to be found

  • interval (tuple) – a tuple of the end points

  • tol (float) – tolerance limit within which the root is to be found

  • maxiter (int, optional) – maximum number of the iterations allowed. Default is 100.

Returns

  • root (float) – computed root of the function

  • iteration (int) – number of iterations used to arrive at the root