Function Repository Resource:

BisectionMethodFindRoot

Source Notebook

Determine the root of an equation using the bisection method

Contributed by: Jason Martinez

ResourceFunction["BisectionMethodFindRoot"][f,{x,xa,xb},tol,n]

searches for a numerical root of f between the points xa and xb using tol digits and up to n steps.

ResourceFunction["BisectionMethodFindRoot"][lhsrhs,{x,xa,xb},tol,n]

searches for a numerical solution to the equation lhs==rhs.

ResourceFunction["BisectionMethodFindRoot"][f,{x,xa,xb},tol,n,property]

returns a property of the search for the root of f.

Details and Options

ResourceFunction["BisectionMethodFindRoot"] supports two options for property:
"Solution"return the root of f
"Steps"return a table of steps taken to reach the root
"PropertyAssociation" can be used to return an Association of the properties.
ResourceFunction["BisectionMethodFindRoot"] terminates when the result is correct to the requested tolerance or the maximum number of steps has been taken, whichever comes first.

Examples

Basic Examples (2) 

Find the root of an expression using the bisection method:

In[1]:=
ResourceFunction["BisectionMethodFindRoot"][
 x - Sqrt[30], {x, 5, 6}, 5, 100]
Out[1]=

Determine the steps to find the root of an equation:

In[2]:=
ResourceFunction["BisectionMethodFindRoot"][
 Cos[x] == x, {x, 0, 1}, 3, 100, "Steps"]
Out[2]=

Scope (1) 

Get the property association of a bisection search:

In[3]:=
ResourceFunction["BisectionMethodFindRoot"][
 x^2 - 2 x, {x, 1, 5}, 5, 100, "PropertyAssociation"]
Out[3]=

Version History

  • 1.0.0 – 02 August 2019

License Information