Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider a function f(x)=cos(x), whose values monotonically decrease from 1 (when x=0 degrees) to 1 (when x=180 degrees) in the range of [0180] for the

image text in transcribed

Consider a function f(x)=cos(x), whose values monotonically decrease from 1 (when x=0 degrees) to 1 (when x=180 degrees) in the range of [0180] for the angle (in degrees). Your task for this question is to come up with a binary search algorithm to determine the largest value of ' x ' ('referred to as the threshold value for x ) for which f(x) is greater than a target 't'. The target ' t ' value can be anywhere in the interval/range (1,,1). Note that this is a open interval, so the ' t ' value will be greater than 1, but less than 1. Termination condition: Run the iterations until the difference between the right index and left index is greater than 0.1. (a) Choose the appropriate initial values for the left index (LI) and right index (RI). (b) State the invariant property that will be maintained for the LI and RI vis-a-vis the f(x) values for the entire algorithm. (c) Provide a pseudo code of the binary search algorithm, including the scenarios when you will move the LI and RI (d) Run the algorithm of (c) for the target 't' value assigned to yo' and show the details (LI, RI, middle index: MI and f(MI) values as well as how the LI or RI are adjusted for each iteration) until the termination. (e) What is the theoretically expected number of iterations based on the initial values for LI and RI as well as the termination condition? How does this compare to the number of iterations observed in (d)? You will get a ZERO if you just use a brute force approach to solve the

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

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

7. List and briefly discuss four management development programs.

Answered: 1 week ago