Pre-Calc Exam Notes 134

Pre-Calc Exam Notes 134 - x 1 − x f x 1 f x 1 − f x = 1...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
134 Chapter 6 Additional Topics §6.2 1. Pick initial points x 0 and x 1 such that x 0 < x 1 and f ( x 0 ) f ( x 1 ) < 0 (i.e. the solution is somewhere between x 0 and x 1 ). 2. For n 2, defne the number x n by x n = x n 1 ( x n 1 x n 2 ) f ( x n 1 ) f ( x n 1 ) f ( x n 2 ) (6.2) as long as | x n 1 x n 2 |> ǫ error , where ǫ error > 0 is the maximum amount o± error desired (usually a very small number). 3. The numbers x 0 , x 1 , x 2 , x 3 , ... will approach the solution x as we go through more itera- tions, getting as close as desired. We will now show how to use this algorithm to solve the equation cos x = x . The solution to that equation is the root o± the ±unction f ( x ) = cos x x . And we saw that the solution is somewhere in the interval [0,1]. So pick x 0 = 0 and x 1 = 1. Then f (0) = 1 and f (1) =− 0.4597, so that f ( x 0 ) f ( x 1 ) < 0 (we are using radians, o± course). Then by defnition, x 2 = x 1
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ( x 1 − x ) f ( x 1 ) f ( x 1 ) − f ( x ) = 1 − (1 − 0) f (1) f (1) − f (0) = 1 − (1 − 0)( − 0.4597) − 0.4597 − 1 = 0.6851 , x 3 = x 2 − ( x 2 − x 1 ) f ( x 2 ) f ( x 2 ) − f ( x 1 ) = 0.6851 − (0.6851 − 1) f (0.6851) f (0.6851) − f (1) = 0.6851 − (0.6851 − 1)(0.0893) 0.0893 − ( − 0.4597) = 0.7363 , and so on. Using a calculator is not very e±fcient and will lead to rounding errors. A bet-ter way to implement the algorithm is with a computer. Listing 6.1 below shows the code (secant.java) ±or solving cos x = x with the secant method, using the Java programming lan-guage:...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online