Secant Method Pseudocode


Table of Contents

This article explains pseudocode for Secant method to find real root of non linear function.

Pseudocode for Secant Method

Pseudocode for Secant method involves following steps in order to solve any non-linear equation with the help of computational tools:

1. Start

2. Define function as f(x)

3. Input:
	a. Initial guess x0, x1
	b. Tolerable Error e
	c. Maximum Iteration N


4. Initialize iteration counter step = 1


5. Do 
	If f(x0) = f(x1)
		Print "Mathematical Error"
		Stop
	End If

	x2 = x1 - (x1 - x0) * f(x1) / ( f(x1) - f(x0) )
	x0 = x1
	x1 = x2
	step = step + 1
	If step > N
		Print "Not Convergent"
		Stop
	End If

   While abs f(x2) > e 

6. Print root as x2

7. Stop