Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Matlab: Consider the following function f(x) = 3 cos (x) 5x find x such that f(x

ID: 673146 • Letter: M

Question

Matlab: Consider the following function

f(x) = 3 cos (x) 5x

find x such that f(x) = 5 (in the form f(x) b = 0, b = 5).

Question 1

Compute the root of Eq. 1 using the bisection method, with the initial bracket [xL, xU ] = [1, 2], Perform only the first 3 iterations, show the approximated error after each iteration.

Question 2

Compute the root of Eq. 1 using the false position, with the initial bracket [xL, xU ] = [1, 2], Perform only the first 3 iterations, show the approximated error after each iteration.

Question 3

Compute the root of Eq. 1 using the secant method, with the initial guesses xG0 = 0 and xG1 = 1, Perform only the first 3 iterations, show the approximated error after each iteration.

Question 4

Compute the root of Eq. 1 using the Newton-Raphson method, with the initial guess xG = 1, Perform only the first 3 iterations, show the approximated error after each iteration.

Explanation / Answer

1)

midpoint m1 = (a+b)/2

f(x) = 3 cos (x) 5x

f(x) = 3 cos (x) 5x

f(x) = 5 (in the form f(x) b = 0, b = 5)

initial bracket [xL, xU ] = [1, 2],

2.5

2) Regula falsi method

f(x) = 3 cos (x) 5x

f(x) = 5 (in the form f(x) b = 0, b = 5)

initial bracket [xL, xU ] = [1, 2],

3) Secant method

x_0 = -5.
x_1 = 5.
x_2 = x_1 - ((x_1-x_0) (3 cos(x_1)-5 x_1))/(5 x_0-5 x_1-3 cos(x_0)+3 cos(x_1))
x_2 = 5. - (4.8298)
x_2 = 0.170197
x_3 = x_2 - ((x_2-x_1) (3 cos(x_2)-5 x_2))/(5 x_1-5 x_2-3 cos(x_1)+3 cos(x_2))
x_3 = 0.170197 - (-0.387358)
x_3 = 0.557555

Newton-Raphson method

N X Accuracy F(x) 2

2.5

3 -14.903 3 1.25 1 -5.304 4 .625 0.6 -0.692