====== Differences ====== This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
gibson:teaching:fall-2014:math445:lab4 [2014/10/21 10:56] gibson |
gibson:teaching:fall-2014:math445:lab4 [2014/10/25 05:01] (current) gibson |
||
---|---|---|---|
Line 2: | Line 2: | ||
- Use a ''for'' loop to perform the Newton-search iteration. Take up to ten Newton steps. | - Use a ''for'' loop to perform the Newton-search iteration. Take up to ten Newton steps. | ||
- | - Use a ''if'' statement inside the ''for'' loop to test if either $|f(x)| < \epsilon$ or $|dx| < \epsilon$. If so, use a ''break'' statement to terminate the iteration and return from the function. For our purposes ''1e-07'' is a decent choice for the value of tolerance $\epsilon$. | + | - Use a ''if'' statement inside the ''for'' loop to test if either $|f(x)| < 2 \epsilon$ or $|dx| < \epsilon$. If so, use a ''break'' statement to terminate the iteration and return from the function. For our purposes ''1e-07'' is a decent choice for the value of tolerance $\epsilon$. |
| | ||