0% found this document useful (0 votes)
20 views4 pages

Secant Method

The document discusses the secant method for finding roots of functions. It begins by describing the secant method and its use of successive secant lines to approximate a root. It then provides an example of using the method to find the root of f(x) = x^2 - 3104. The discussion includes plotting the graph, choosing initial points, and performing iterations using the secant method formula. It shows the Python code used and outputs the root approximation of 55.71355307 after 12 iterations with inputs of 1, 2, and a tolerance of 0.001.

Uploaded by

21-08523
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views4 pages

Secant Method

The document discusses the secant method for finding roots of functions. It begins by describing the secant method and its use of successive secant lines to approximate a root. It then provides an example of using the method to find the root of f(x) = x^2 - 3104. The discussion includes plotting the graph, choosing initial points, and performing iterations using the secant method formula. It shows the Python code used and outputs the root approximation of 55.71355307 after 12 iterations with inputs of 1, 2, and a tolerance of 0.001.

Uploaded by

21-08523
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Secant Method

The secant method also known as the 2-point method in numerical analysis is a
root-finding algorithm that uses a succession of roots of secant lines to better approximate a root
of a function f. The Secant Method is a practical and efficient way to approximate roots of
functions, particularly when the function's derivative is not readily available or when calculating
the derivative is computationally expensive. However, it's essential to choose initial guesses
carefully to ensure convergence, as the method may not always converge if the initial points are
too far apart or if the function exhibits particular behavior near the root.

We are given the equation: f(x) =x^2 - 3104

Since the equation given has a positive ax^2 then we can determine that it is a parabola that
opens upwards from the point -3104 in the y-axis.

Graphing the Equation using a software:

Starting Point of the Graph Roots of the Graph

From the graph we can determine that the root should be approximately equal to 55.714.

𝑥1−𝑥0
Using the secant method: 𝑥2 = 𝑥1 − 𝑓(𝑥1) 𝑓(𝑥1)−𝑓(𝑥0)

Where we have the first initial guess x0 and the second initial guess x1, x2 shall be the
value which will converge to determine the root of the equation.
Algorithm of Secant Method

The Secant Method is a numerical technique used to approximate the root of a


real-valued function. It's an iterative method that doesn't require the computation of derivatives:

● Start with two initial approximations, x0 and x1, such that f(x0) and f(x1) have different
signs, i.e., f(x0) * f(x1) < 0. These initial points define an interval containing the root.
● For each iteration, compute the next approximation, x2, using the formula: x2 = x1 -
(f(x1) * (x1 - x0)) / (f(x1) - f(x0))
● Check for convergence. You can use various stopping conditions, such as a specified
number of iterations, a maximum allowed error, or a tolerance level
● If the stopping condition is met, consider x2 as the approximate root and stop the
algorithm.
● If the stopping condition is not met, update the values of x0 and x1 as follows: x0 = x1,
x1 = x2
● Go back to step 2 and repeat the process until the convergence criteria are satisfied.

Discussion and Analysis

Figure 1: Code for the secant method


The code shown in the figure is an implementation of the secant method to find the root
2
of the equation f(x) = x - 3104. The secant method is also an iterative numerical technique used
to find the root of a real-valued function. The basic idea is to start with two initial guesses that
bracket the root (i.e., the function has opposite signs at those points), and then iteratively refine
the guess until the root is found within a specified tolerance. The function f(x) is defined to
represent the equation f(x) = x^2 - 3104. It takes three arguments: `x0` and `x1` are the initial
guesses, and `e` is the tolerable error. The code then takes user input for the initial guesses `x0`
and `x1` and the tolerable error `e`. The user's input values are converted to floating-point
numbers. The code checks if the initial guesses `x0` and `x1` bracket the root. the code prints a
message indicating that the guess values do not bracket the root. The secant method is executed
in a loop until the absolute value of `f(x2)` is less than the specified tolerable error `e`. In each
iteration, it calculates a new approximation `x2` and updates `x0` and `x1`. Once the root is
found within the specified tolerance, the code prints the final result. To use this code to find the
root of equation f(x) = x^2 - 3104, enter a first guess for `x0` which is 1, enter a second guess for
`x1` which is 2, and enter a tolerable error `e` which is 0.001. The code will perform the secant
method to find the root and display the result.

Result and Discussion

2
Figure 2: Result for the equation x -3104 using the secant method
The result obtained from the secant method implementation is a root approximation of
the function f(x) = x^2 - 3104. Starting with the initial guesses of 1 and 2 and a tolerable error of
0.001, the secant method went through 12 iterations to narrow down the interval where the root
exists. The iterative process, as shown in the output, effectively divided the interval into smaller
subintervals, systematically approaching the root. The final result, which is approximately
55.71355307, represents a very close approximation to the actual root of the function. This result
demonstrates the secant method's reliability and accuracy in finding roots, provided the initial
interval brackets the root and the specified tolerance level is met. It's essential to choose initial
guesses and a tolerance level carefully to ensure the success of the method, and this result
demonstrates the effectiveness of the bisection method in finding the root of the function f(x) =
x^2 - 3104 and locating roots with precision. The initial guesses and the specified tolerable error
were used to perform a series of iterations, each step further narrowing down the interval where
the root is located. The method successfully converged to an approximation of the root, which is
approximately 55.71355307. What makes this method particularly advantageous is its
independence from the need for derivative information. Moreover, its versatility allows it to be
applied to a wide range of functions, even those that might not be differentiable but are
continuous. One of its strengths lies in its potential for rapid convergence, especially when
well-chosen initial approximations are employed. It often manages to find a root in just a few
iterations, which can result in computational efficiency. The Secant Method's simplicity in terms
of both understanding and implementation makes it accessible to a broad audience, enabling
individuals without advanced mathematical or programming skills to utilize it effectively.

References
Admin. (2022). Secant method - definition, procedure, and example. BYJUS.
https://byjus.com/maths/secant-method/

Admin. (n.d). “Python Operators,”. www.w3schools.com.


https://www.w3schools.com/python/python_operators.asp

You might also like