Western University Department of Applied Mathematics AM3611F: October 14, 2020 Project 1: ZEROS AND EXTREMA OF FUNCTIONS Due: October 28 Instructor: Dr. Z. Krougly Total of 22 marks. 1. (2 marks) Organize the project to implement Secant method for finding the root of f(x) = 0 (secant.cpp program is posted on OWL). Consider a general procedure that converges almost as far as Newton's method. This method mimics Newton's method but avoids the calculation of derivatives. Recall that NeZWRQ¶V iWeUaWiRQ defines +ଵ in terms of via the formula +ଵ ൌ െ ሺ௫ሻ ᇲሺ௫ሻ (1) In the secant method, we replace ᇱሺሻ in Formula (1) by an approximation that is easily computed. Since the derivative is defined by ᇱሺሻ ൌ lim → ሺ ℎሻ െ ሺሻ ℎ we can say that for small h, ᇱሺሻ ൎ ሺ ℎሻ െ ሺሻ ℎ In particular, if ൌ , and ℎ ൌ −ଵ െ , we have ᇱሺሻ ൎ ሺ௫షభሻ−ሺ௫ሻ ௫షభ− ௫ (2) When this is used in Equation (1), the result defines the Secant method: +ଵ ൌ െ ቀ ௫−௫షభ ሺ௫ሻ−ሺ௫షభሻ ቁ ሺሻ (3) The SecaQW PeWhRd (Oike NeZWRQ¶V) caQ be XVed WR solve systems of equations as well. A few remarks about Equation (3) are in order. Clearly, +ଵ depends on two previous elements of the sequence. So in order to start, two points (x0, and x1) must be provided. Equation (3) can then generate x2, x3,« Complete the iterations when |f(xn) - f(xn-1)| ≤ İ |f(xn)| for some specific tolerance İ, such as 0.5×10-6 . Another convergence criterion is: interval < epsilon (see program secant.cpp on OWL) 2. (5 marks) Use Secant method to find a solution to (a) ൌ cos (b) x3 = cos x with x0 = 0.5 and x1 = ʌ/4. Print the solutions with 10 decimal places. 3. (5 marks) Find the root of the functions using Secant method: (a) f1(x) = 27x4 + 162x3 - 180x2 + 62x ± 7 with starting values x0 = 0 and x1 = 2 (b) f3(x) = 1 + ln x – x with starting values x0 = -1 and x1 = 2 Use convergence test with the tolerance İ = 1×10-6. 4. (5 marks) Use Secant method to find the optimum solutions (௫/ and ௫/ሻ for the function ሺሻ ൌ sin ቀ ଵ ௫ ቁ on the interval (0.1, 0.3). 5. (5 marks) Organize user interface in one workspace with the projects of the problems 2, 3 and 4. Use dynamic memory allocation and vector of pointers to a function (see topic 9 on OWL). What to Hand In. x Problems 2-5: Submit the programs and outputs electronically by OWL (Drop Box). x Specify your name, course number, and the project number. topic 9)
欢迎咨询51作业君