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

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

View Full Document Right Arrow Icon
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:
Background image of page 1

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

View Full DocumentRight Arrow Icon
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. Let's zoom in on our graph more closely to get started:
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 02/10/2011.

Page1 / 5

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

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online