Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am doing interval bisection in my numerical analysis class and I'm a little confused on trying to complete the C program to get the

I am doing interval bisection in my numerical analysis class and I'm a little confused on trying to complete the C program to get the interval bisection to work. image text in transcribed
image text in transcribed
The interval bisection method works iff the function is continuous and you can establish an initial left & right guess, such that: f(left) and f(right) have different signs (i.e.: one is positive and the other negative) COMPILE THIS CODE BY RUNNING: gcc interval_bisection04_lab.c-Im The -Im links with the math library * #include #include #include double f1 (double x) double y; y = x*x-2; return y; } double f2 (double x) // three roots, 11 -3 - sqrt(3) = -4.732050, // -3 + sqrt(3) = -1.267949, // 6 { double y: y = x*x*x - 30*x - 36; return y; } // f points at a function with one double input and a double output int interval_bisection(double (*f)(double x), double left, double right, double epsilon, int maxreps, double results[2]) // return 0 failure, else 'numreps' (>= 1) // 'maxreps' is the maximum iterations through the loop { // example of a valid function call to f: || double fl; // fl = f(left); // The algorithm should continue until 'maxreps' iterations have been // performed or the width of the interval is within 'epsilon' // your code goes here! } The interval bisection method works iff the function is continuous and you can establish an initial left & right guess, such that: f(left) and f(right) have different signs (i.e.: one is positive and the other negative) COMPILE THIS CODE BY RUNNING: gcc interval_bisection04_lab.c-Im The -Im links with the math library * #include #include #include double f1 (double x) double y; y = x*x-2; return y; } double f2 (double x) // three roots, 11 -3 - sqrt(3) = -4.732050, // -3 + sqrt(3) = -1.267949, // 6 { double y: y = x*x*x - 30*x - 36; return y; } // f points at a function with one double input and a double output int interval_bisection(double (*f)(double x), double left, double right, double epsilon, int maxreps, double results[2]) // return 0 failure, else 'numreps' (>= 1) // 'maxreps' is the maximum iterations through the loop { // example of a valid function call to f: || double fl; // fl = f(left); // The algorithm should continue until 'maxreps' iterations have been // performed or the width of the interval is within 'epsilon' // your code goes here! }

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

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions

Question

Define Management by exception

Answered: 1 week ago

Question

Explain the importance of staffing in business organisations

Answered: 1 week ago

Question

What are the types of forms of communication ?

Answered: 1 week ago

Question

Explain the process of MBO

Answered: 1 week ago

Question

6. Explain how to train managers to coach employees.

Answered: 1 week ago