intro Link to heading

  • The term graphical method related root finding might have lots of meanings as follow.
    • The graphical method can also be presented in the form of perpendicular segements representing polynomial coefficients in the process of finding the real roots of pthe polynomial (Eisenberg, 1967).
    • For complex roots the graphical method perform the analysis in the form of contour in complex plane (Pfeiffer, 1979).
    • There is also other graphical technique for nonlinear algebraic equations that employs two graphs of the zero-curves of the real and imaginary parts of the polynomial for locating roots approximate location (Mitsui, 1983).
    • Not to related to topic covered here, graphical study in the other form, e.g. polynomiography, can be very helpful in studying the newly development of root-finding algorithm (Naseem et al., 2023).
  • In this note the meanings of the graphical method are limited only to the following.
    • Graphical method is classified as bracketing methods in root finding methods, which is not very percise (Hedge, 2015).
    • It is used usually to find real roots of an equation (Vaniya, 2020).

method Link to heading

  • It draws the function $f(x)$ againts $x$ and try to locate as near as possible to get $x = r$, which makes $f(r) = 0$.
  • Choose a range $x \in [x_a, x_b]$ where $x_a < r < x_b$ holds.
  • Zoom in by changing the range to $x \in [x_a', x_b']$ as long as $x_a' < r < x_b'$ holds until expected precision, where $x_a' > x_a$ and $x_b' < x_b$.

example Link to heading

  • Suppose that there is function $$\tag{1} f(x) = x^3 + 1.2345x^2 - 9.876x - 1 $$ where one root lies between $2$ and $3$.

graphs Link to heading

  • Figure 1. Plot $f(x)$ for $x \in [0, 10]$.
  • Figure 2. Plot $f(x)$ for $x \in [0, 5]$.
  • Figure 3. Plot $f(x)$ for $x \in [2, 4]$.
  • Figure 4. Plot $f(x)$ for $x \in [2.6, 2.8]$.
  • Figure 5. Plot $f(x)$ for $x \in [2.64, 2.66]$.
  • Figure 6. Plot $f(x)$ for $x \in [2.642, 2.644]$.
  • Figure 7. Plot $f(x)$ for $x \in [2.6438, 2.6440]$.

results Link to heading

  • From Figure 1 the root is hardly seen, lies between 2 and 3.
  • From Figure 2 it can be said that $r \approx 2.5$.
  • From Figure 3 it can be said that $r \approx 2.6$.
  • From Figure 4 it can be said that $r \approx 2.64$.
  • From Figure 5 it can be said that $r \approx 2.644$.
  • From Figure 6 it lies between $2.6438$ and $2.6440$.
  • From Figure 7 in can be obtained that $r \approx 2.64392$, which gives $f(r) \approx 1.07305 \times 10^{-3}$.

code Link to heading

  • Code 1. Generate data for xy scatter plot using Chart.js.
    def generate_data(xa, xb, n):
      dx = (xb - xa) / n
      xx = [(xa + i * dx) for i in range(n+1)]
      yy = []
      for x in xx:
        y = f(x)
        yy.append(y)
      return [xx, yy]
    
    def f(x):
      y0 = -1
      y1 = -9.876 * x
      y2 = 1.2345 * x**2
      y3 = x**3
      y = y0 + y1 + y2 + y3
      return y
    
    n = 10
    
    [x, y] = generate_data(0, 10, n)
    for i in range(n + 1):
      print("{x:", x[i], ", y:", y[i], "},", sep='')
    print()
    
    [x, y] = generate_data(0, 5, n)
    for i in range(n + 1):
      print("{x:", x[i], ", y:", y[i], "},", sep='')
    print()
    
    [x, y] = generate_data(2, 4, n)
    for i in range(n + 1):
      print("{x:", x[i], ", y:", y[i], "},", sep='')
    print()
    
    [x, y] = generate_data(2.6, 2.8, n)
    for i in range(n + 1):
      print("{x:", x[i], ", y:", y[i], "},", sep='')
    print()
    
    [x, y] = generate_data(2.64, 2.66, n)
    for i in range(n + 1):
      print("{x:", x[i], ", y:", y[i], "},", sep='')
    print()
    
    [x, y] = generate_data(2.642, 2.644, n)
    for i in range(n + 1):
      print("{x:", x[i], ", y:", y[i], "},", sep='')
    print()
    
    [x, y] = generate_data(2.6438, 2.6440, n)
    for i in range(n + 1):
      print("{x:", x[i], ", y:", y[i], "},", sep='')
    print()
    
    url https://onecompiler.com/python/3zxhdejsr.

challenges Link to heading

  • Try to find $r$ that makes $f(r) \approx 10^{-4}$ for $f(x)$ in Equation (1).
  • Could you try further for $r$ that makes $f(r) \approx 10^{-5}$ for the same equation? Give the result.
  • Why does the function $f(x)$ seem to be linear, when the range becomes narrower?

refs Link to heading