Bisection Method

Enter a function to find its roots
\frac{\sin(x)}{x}
Lower bound of the interval
Upper bound of the interval
Tolerance of the method
Maximum number of iterations

False Position Method

Enter a function to find its roots
\frac{\sin(x)}{x}
Lower bound of the interval
Upper bound of the interval
Tolerance of the method
Maximum number of iterations

Newton-Raphson Method

Enter a function to find its roots
x^2-2
Initial guess: x0
Tolerance of the method
Maximum number of iterations

Secant Method

Enter a function to find its roots
x^2-2
First initial guess: x0
Second initial guess: x1
Tolerance of the method
Maximum number of iterations

Summary

  • Function \sin(x) / x
  • Python Function sin(x)/x
  • Lower Bound 1
  • Upper Bound 4
  • Initial Guess None
  • Second Initial Guess None
  • Tolerance 0.0001
  • Iteration Limit 100
  • Root 3.1416015625
  • Iteration Count 10
  • Error 2.835786152192458e-06
  • Condition True

Condition

  • The interval must contain a root
  • The function must be continuous
  • The function must change sign over the interval
  • The maximum number of iterations must be enough to find the root

f(1.0) = 0.841471

f(4.0) = -0.189201

(0.841471) x (-0.189201) < 0

Iterations

  • If f(c) = 0, then c is the root
  • If f(a) * f(c) < 0, then the root is in the interval [a, c]
  • If f(b) * f(c) < 0, then the root is in the interval [c, b]
  • Repeat until the root is found

Iteration 1 of 10 with (1.0, 4.0)

c = (1.0 + 4.0) / 2 = 2.5
f(a) = f(1.0) = 0.841471
f(b) = f(4.0) = -0.189201
f(c) = f(2.5) = 0.239389

|f(c)| = |0.239389| > 0.0001 = Tolerance

(a', b') = (2.5, 4.0)


Iteration 2 of 10 with (2.5, 4.0)

c = (2.5 + 4.0) / 2 = 3.25
f(a) = f(2.5) = 0.239389
f(b) = f(4.0) = -0.189201
f(c) = f(3.25) = -0.033291

|f(c)| = |-0.033291| > 0.0001 = Tolerance

(a', b') = (2.5, 3.25)


Iteration 3 of 10 with (2.5, 3.25)

c = (2.5 + 3.25) / 2 = 2.875
f(a) = f(2.5) = 0.239389
f(b) = f(3.25) = -0.033291
f(c) = f(2.875) = 0.091633

|f(c)| = |0.091633| > 0.0001 = Tolerance

(a', b') = (2.875, 3.25)


Iteration 4 of 10 with (2.875, 3.25)

c = (2.875 + 3.25) / 2 = 3.0625
f(a) = f(2.875) = 0.091633
f(b) = f(3.25) = -0.033291
f(c) = f(3.0625) = 0.025799

|f(c)| = |0.025799| > 0.0001 = Tolerance

(a', b') = (3.0625, 3.25)


Iteration 5 of 10 with (3.0625, 3.25)

c = (3.0625 + 3.25) / 2 = 3.15625
f(a) = f(3.0625) = 0.025799
f(b) = f(3.25) = -0.033291
f(c) = f(3.15625) = -0.004644

|f(c)| = |-0.004644| > 0.0001 = Tolerance

(a', b') = (3.0625, 3.15625)


Iteration 6 of 10 with (3.0625, 3.15625)

c = (3.0625 + 3.15625) / 2 = 3.109375
f(a) = f(3.0625) = 0.025799
f(b) = f(3.15625) = -0.004644
f(c) = f(3.109375) = 0.01036

|f(c)| = |0.01036| > 0.0001 = Tolerance

(a', b') = (3.109375, 3.15625)


Iteration 7 of 10 with (3.109375, 3.15625)

c = (3.109375 + 3.15625) / 2 = 3.132812
f(a) = f(3.109375) = 0.01036
f(b) = f(3.15625) = -0.004644
f(c) = f(3.132812) = 0.002803

|f(c)| = |0.002803| > 0.0001 = Tolerance

(a', b') = (3.132812, 3.15625)


Iteration 8 of 10 with (3.132812, 3.15625)

c = (3.132812 + 3.15625) / 2 = 3.144531
f(a) = f(3.132812) = 0.002803
f(b) = f(3.15625) = -0.004644
f(c) = f(3.144531) = -0.000935

|f(c)| = |-0.000935| > 0.0001 = Tolerance

(a', b') = (3.132812, 3.144531)


Iteration 9 of 10 with (3.132812, 3.144531)

c = (3.132812 + 3.144531) / 2 = 3.138672
f(a) = f(3.132812) = 0.002803
f(b) = f(3.144531) = -0.000935
f(c) = f(3.138672) = 0.000931

|f(c)| = |0.000931| > 0.0001 = Tolerance

(a', b') = (3.138672, 3.144531)


Iteration 10 of 10 with (3.138672, 3.144531)

c = (3.138672 + 3.144531) / 2 = 3.141602
f(a) = f(3.138672) = 0.000931
f(b) = f(3.144531) = -0.000935
f(c) = f(3.141602) = -3e-06

|f(c)| = |-3e-06| ≤ 0.0001 = Tolerance

Root = 3.1416015625
Error = ± 2.835786152192458e-06