3. Problem 3: Find two roots of the equation cos(x)e-2sin(3 In (x²)) = 0, on the interval [4, 10]. Explain how many decimal places you believe you have correct, and how many steps of the bisection method it took. Also include timing results for your calculations.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter14: Numerical Methods
Section14.3: Refinements To The Bisection Method
Problem 4E
icon
Related questions
Question
Please use python and show codes. The second picture is a different example we did
import math
import time
#Want a root of f(x) = cos(x) x^2/2
def f(x):
return math.cos(x)
tol=10**-15
a
= 0.5
b = 1.5
Error =
c = math.nan
count = 0
(b-a)/2
tic time.time()
if f(a) f(b) < 0:
while (Error > tol) and (count < 1000):
X
c = (a+b)/2
if f(a) f(c) < 0:
b = c
elif f(b) f(c) < 0:
a = c
Error = (b-a)/2
count = count + 1
toc = time.time()
runTime = toc - tic
print ()
print (c)
print (Error)
print (f(c))
print (runTime)
print (count)
print()
Transcribed Image Text:import math import time #Want a root of f(x) = cos(x) x^2/2 def f(x): return math.cos(x) tol=10**-15 a = 0.5 b = 1.5 Error = c = math.nan count = 0 (b-a)/2 tic time.time() if f(a) f(b) < 0: while (Error > tol) and (count < 1000): X c = (a+b)/2 if f(a) f(c) < 0: b = c elif f(b) f(c) < 0: a = c Error = (b-a)/2 count = count + 1 toc = time.time() runTime = toc - tic print () print (c) print (Error) print (f(c)) print (runTime) print (count) print()
3. Problem 3: Find two roots of the equation
cos(x)e-2sin (3 ln(x²)) = 0,
on the interval [4, 10]. Explain how many decimal places you believe
you have correct, and how many steps of the bisection method it took.
Also include timing results for your calculations.
Transcribed Image Text:3. Problem 3: Find two roots of the equation cos(x)e-2sin (3 ln(x²)) = 0, on the interval [4, 10]. Explain how many decimal places you believe you have correct, and how many steps of the bisection method it took. Also include timing results for your calculations.
Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Recurrence Relation
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr