Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in C++ please keep it as simple as possible thank you Some background information The Bisection Method is a numerical method in mathematics used to

in C++ please
keep it as simple as possible thank
you
image text in transcribed
image text in transcribed
Some background information The Bisection Method is a numerical method in mathematics used to find a root of a given function A root of a function fis a value a for which f(a)- 0 For example, for f(x)x2-9, the roots of fare x 3 and x--3 A consequence of the Intermediate Value Theorem is that if a function fis continuous on the closed interval [a, b], with f(a) positive and f(b) negative (or vice versa), then there is a root of f somewhere in [a, b]. See the figure below fx) Fhere is a in La..b I root sab Ct ma sign of Ra)sign of b) The Bisection Method is an iterative approximation method. Given a function and an initial interval [a, b] that contains a root of the function, it will repeatedly perform the following process -if f(a)f(b) > 0, display an appropriate error message and then terminate the 1) find c, the midpoint between a and b, and f( c). c is the "current 2) display the iteration number, the current interval [a, b], the current tolerance value, then stop and display the approximate root (the value of c at that process - otherwise, approximation" of the root. approximation c, and the current "error" value, f(c) 3a) If the absolute value of the current error is less than a predetermined time) 3b) Otherwise, determine the next interval. If the product of f(a) and f(c) is less than zero, the next interval should be [a, c]. If not, the next interval should be [c, b]. time) 3b) Otherwise, determine the next interval. If the product of f(a) and f(c) is less than zero, the next interval should be [a, c]. If not, the next interval should be [c, b] Write a program to implement the bisection method on a function f, on the interval [a, b]. The program should contain a function to evaluate a particular f (x) Test your program using f(x)-x3-sinx on [0.5, 2] to find a root accurate to five decimal places. That is, write a function that will return f(x), use [0.5, 2] as the initial interval, and stop the iterative process when f(x) is less than or equal to 0.000005 CLARIFICATION: Your program is NOT expected to "input a function from the user The function mentioned above should evaluate the mathematical function currently being studied (here, f(x)-: x3-sinx). If a different mathematical function is to be studied, this C++ function would have to be rewritten. Your source code file should contain appropriate documentation and you should use meaningful identifiers. You should also observe the format conventions mentioned in class (indention, etc.). Your source code file should be named bisection.cpp. Turn in your project by submitting the source code file as an attachment to a Blackboard course message. Do NOT send your executable file. As with all projects, to receive a grade you must discuss your project with me in my office. Further specifications and/or restrictions may be given in class. Sample output for a different problem: finding a root of fx)-3, between 1 and 2 Iteration Interval [a, b] Approximate root Error [1.50000000, 2.00000000] [1.50000000, 1.75000000] 0.06250000 -0.35937500 1.62500000 18 [1.73204803, 1.73205566] 1.73205185 0.00000358 The approximate root is: 1.73205185

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

Students also viewed these Databases questions

Question

1. What makes Zipcar an attractive employer for whom to work?

Answered: 1 week ago