# lab14 - Lab 14 A First Taste of Root Finding Last Modified...

This preview shows pages 1–3. Sign up to view the full content.

Lab 14: A First Taste of Root Finding Last Modified 03/16/2009 Key Concepts: functions, prototypes, parameter passing This lab will be a little bit different from the rest so far, in two ways: Here's the first place where the calculus prerequisite comes in. Remember the Intermediate Value Theorem (IVT) ? That's the one that basically says if you have a function f that's continuous on an interval [ a , b ] and some value y between the y -values of f at the endpoints (formally f ( a ) and f ( b )), then the function takes on the value y at some point between a and b . Okay, we won't prove anything, but without the all-powerful IVT, what we're going to do today would never work. We're going to get our first taste of numerical analysis , the field of mathematics and computer science where we can use computer programs to solve mathematical problems using computations and trial and error (and very little analytical algebra and calculus). All of the labs and assignments you've done so far have involved you writing your own code. Indeed, we'll keep that up, but an important skill of a successful programmer is to read, debug, modify, and otherwise work with code you didn't write. This is one of the major reasons I've stressed good documentation throughout the course. Now, the particular numerical analysis is one of the more straightforward techniques, but would take at least a few hours to write from scratch. So, I'm going to give you MOST of the code and have you make some changes to get to a functional program. Theory We're going to work in the context of an example. Consider the following function: f ( x ) = x 3 + 4 x 2 - 10 Here's what its graph looks like:

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Remember that the zeroes or roots of a function are the x -coordinates where the function's graph crosses the x -axis. The function is a cubic polynomial. There are some sophisticated analytical methods you may have learned in a precalculus class that can help you find its roots, but analytical methods can prove rather challenging here. We're not going to use them. Let's try graphically. From this view of the graph, we can get an idea where the polynomial's graph crosses the horizontal axis. We could zoom in to get an idea of the zeroes. Suppose we'd like a numerical solution.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern