If you need to know the root of the function f(x) = 0 (the solution of x), then:
First, define an interval [a, b] so that it contains the root of the equation.
Find the midpoint of the interval and the value of f(m)
If the signs of f(m) and f(a) are the same, take [m, b] as the new interval, otherwise take [a, m].
Repeat step 2 to achieve the required accuracy.
example
For example, find the solution of the equation sinh x = cos x, where sinh is hyperbolic sine, cos is cosine, and x is in radians.
Define f (x) = sinh x-cos x. So here is the root that requires f(x) = 0.
Draw y = f(x) and know that its root is between 0.5 and 1, so make the initial interval [0.5, 1].
The midpoint of this interval is 0.75.
Because the signs of F (0.5) ≈-0.3565 and F (0.75) ≈ 0.0906 are different, the new districts are [0.5, 0.75].
The midpoint of the interval is 0.625, f(0.625) ≈ -0. 1445, which is the same sign as f(0.5), so the new interval is [0.625, 0.75].
The root of f(x) = 0 after repeated operations is about 0.7033.
From a philosophical point of view, it is a way to consider problems, and we should know how to consider the pros and cons of problems.