Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Note: Use MATLAB to solve all of the tasks. For each task, TOL is the required tolerance, and Nmax is the maximum number of iterations

Note: Use MATLAB to solve all of the tasks. For each task, TOL is the required tolerance, and Nmax is the maximum number of iterations allowed. You must print if the function executed successfully or not, where success is defined as TOL being satisfied at or before Nmax. Your function must print the values of pn and f(pn) at each iteration n. Each MATLAB function must be saved as a separate .m file. Use format long to print numbers with a higher number of decimal places.

Please do not give me incorrect or incomplete code.

Task 1 Given a continuous function f on the interval [a, b] where f(a) and f(b) have opposite signs, implement the Bisection method as a MATLAB function bisection(f, a, b, TOL, Nmax) to find a solution to the equation f(x) = 0, where f is an inline function; a and b are the lower and upper bounds, respectively, of the given interval;

Task 2 Implement the Fixed-Point Iteration method as a MATLAB function fixedPt(g, p0, TOL, Nmax) to find a solution to the equation p = g(p), where g is an inline function; p0 is an initial estimate

Task 3 Implement the Newtons method as a MATLAB function newton(f, p0, TOL, Nmax) to find a solution to the equation f(x) = 0, where f is an inline function; p0 is an initial estimate. Hint: given an inline function f, the command diff(sym(f)) returns the derivative of f as an inline function.

Task 4 Implement the Secant method as a MATLAB function, secant(f, p0, p1, TOL, Nmax), to find a solution to the equation f(x) = 0, where f is an inline function; p0, p1 are initial approximations.

Task 5 Given a continuous function f on the interval [p0, p1] where f(p0) and f(p1) have opposite signs, implement the false position method as a MATLAB function falsePos(f, p0, p1, TOL, Nmax) to find a solution to the equation f(x) = 0, where f is an inline function; p0, p1 are initial approximations.

Task 6 Use the Fixed-Point iteration method fixedPt(g, p0, TOL, Nmax) to solve a) x = 0.5(sin(x) cos(x)) b) x = 6 x For both equations, use p0 = 0.5, TOL = 108 , Nmax = 80.

Task 7 Let f(x) = tan(x) 6. Solve f(x) = 0 using a) bisection(f, a, b, TOL, Nmax) with a = 0, b = 0.48 b) newton(f, p0, TOL, Nmax) with p0 = 0.2 c) secant(f, p0, p1, TOL, Nmax) with p0 = 0, p1 = 0.48 d) falsePos(f, p0, p1, TOL, Nmax) with p0 = 0, p1 = 0.48 Use TOL = 1010 , Nmax = 100 in all four methods. Which method uses the least amount of iterations to satisfy the tolerance?

Task 8 Let f(x) = 230x 4 + 18x 3 + 9x 2 221x 9. Solve f(x) = 0 using a) bisection(f, a, b, TOL, Nmax) with a = -1, b = 0 b) newton(f, p0, TOL, Nmax) with p0 = -0.5 c) secant(f, p0, p1, TOL, Nmax) with p0 = -1, p1 = 0 d) falsePos(f, p0, p1, TOL, Nmax) with p0 = -1, p1 = 0 Use TOL = 1015 , Nmax = 100 in all four methods. Which method uses the least amount of iterations to satisfy the tolerance?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And SQL

Authors: Lucy Scott

3rd Edition

1087899699, 978-1087899695

Students also viewed these Databases questions