Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Problem 1. Secant method This is a slightly modified version of Problem 6.13 [Pav, page 65]. The proble is modified to return whether or not

image text in transcribed

Problem 1. Secant method This is a slightly modified version of Problem 6.13 [Pav, page 65]. The proble is modified to return whether or not the method encountered an error while looking for a root. Implement the secant method. Your m-file should have a header line like: function [x error] = runsecant (f, x0, x1, N, tol) where f is a string denoting the name of the function, z0 and rl the two initial guesses, N the iteration limit, and tol the tolerance parameter. Implement the function runsecant based on the scant method pseudocode on Page 62 [Pav]. Modify it to set error to true when unable to find a root: either because the slope is too small (Line 7) or because when the maximum number is exceed. To display a warning use the warning function, e.g. warning ('slope too small: giving up'; Otherwise, it sets error to false and sets r to the root. Use the feval function explained in Problem 1. Run your function to find zeroes of the following functions. Use random intitial guesses between -1 (a) a(z)=12-1. (b) b(x) = tan(x)-z. (c)(a) 21 (Note: this function also has no zeros). and-1 (:0 2 * rand-1 and x1 = 2 * rand-1). Problem 1. Secant method This is a slightly modified version of Problem 6.13 [Pav, page 65]. The proble is modified to return whether or not the method encountered an error while looking for a root. Implement the secant method. Your m-file should have a header line like: function [x error] = runsecant (f, x0, x1, N, tol) where f is a string denoting the name of the function, z0 and rl the two initial guesses, N the iteration limit, and tol the tolerance parameter. Implement the function runsecant based on the scant method pseudocode on Page 62 [Pav]. Modify it to set error to true when unable to find a root: either because the slope is too small (Line 7) or because when the maximum number is exceed. To display a warning use the warning function, e.g. warning ('slope too small: giving up'; Otherwise, it sets error to false and sets r to the root. Use the feval function explained in Problem 1. Run your function to find zeroes of the following functions. Use random intitial guesses between -1 (a) a(z)=12-1. (b) b(x) = tan(x)-z. (c)(a) 21 (Note: this function also has no zeros). and-1 (:0 2 * rand-1 and x1 = 2 * rand-1)

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_2

Step: 3

blur-text-image_3

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

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students explore these related Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 3 weeks ago