Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 2.2-1: Find the root of f(x)4z2 - 10 using the bisection method, with the following specifications a) Modify the Julia code for the bisection

image text in transcribedimage text in transcribed

image text in transcribed

image text in transcribed

Exercise 2.2-1: Find the root of f(x)4z2 - 10 using the bisection method, with the following specifications a) Modify the Julia code for the bisection method so that the only stopping criterion is whether f(p) -0 (remove the other criterion from the code). Also, add a print statement to the code, so that every time a new p is computed, Julia prints the value of p and the iteration number b) Find the number of iterations N necessary to obtain an accuracy of 104 for the root, using the theoretical results of Section 2.2. (The function f(x) has one real root in (1,2), so set a-1,b 2.) a 1, b 2 in the modified Julia code is used to approximate the actual root, i.e., find |p- PN Compare this error, with the c) Run the code using the value for N obtained in part (b) to compute Pi, P2,.., PN (set d) The actual root, correct to six digits, is p 1.36523. Find the absolute error when pv upper bound for the error used in part (b). In [1]: function bisection(f: Function,a,b,eps, N) n-1 p-o. # to ensure the alue of p carries out of the while loop while n x"5+2x 3-5x-2,0,2,10(-4.),5) Method did not converge. The last iteration gives 1.3125 with function value-0.14562511444091797 Exercise 2.2-1: Find the root of f(x)4z2 - 10 using the bisection method, with the following specifications a) Modify the Julia code for the bisection method so that the only stopping criterion is whether f(p) -0 (remove the other criterion from the code). Also, add a print statement to the code, so that every time a new p is computed, Julia prints the value of p and the iteration number b) Find the number of iterations N necessary to obtain an accuracy of 104 for the root, using the theoretical results of Section 2.2. (The function f(x) has one real root in (1,2), so set a-1,b 2.) a 1, b 2 in the modified Julia code is used to approximate the actual root, i.e., find |p- PN Compare this error, with the c) Run the code using the value for N obtained in part (b) to compute Pi, P2,.., PN (set d) The actual root, correct to six digits, is p 1.36523. Find the absolute error when pv upper bound for the error used in part (b). In [1]: function bisection(f: Function,a,b,eps, N) n-1 p-o. # to ensure the alue of p carries out of the while loop while n x"5+2x 3-5x-2,0,2,10(-4.),5) Method did not converge. The last iteration gives 1.3125 with function value-0.14562511444091797<><>

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

Databases Demystified

Authors: Andrew Oppel

1st Edition

0072253649, 9780072253641

More Books

Students also viewed these Databases questions

Question

2. How were various roles filled?

Answered: 1 week ago