### COMP203: Lecture 23

**Syllabus | Homework and Assignments |
Grading Rubric | Midterm Exam | Final Project
**

Today we'll use Maple to write a program that uses Newton's method to search for the zeros (x-intercepts) of a function. You can find information on Newton's method in lectures 7 and 11 on Logo, on the internet, and in Maple. Maple already has a bulit-in tool for using Newton's method -- feel free to explore it, but don't use it in your program!
Your completed program should accept a function or expression and a guess at an x-intercept as inputs. It should output an "improved guess" at the x-intercept.

*SAVE YOUR WORK OFTEN!* It's not always possible to stop Maple when it gets into an infinite loop.

Some things to think about:

- It is
*strongly recommended* that you test each step of your algorithm in Maple before trying to write a program.
- Do you want to work with functions or expressions? Each has advantages and drawbacks.
- How will you compute the derivative of your function or expression? The Maple function diff() may or may not be a good tool for this.
- What will you do with the derivative once you've found it? Note that the Maple command:

fprime := x -> diff(f(x),x);

probably doesn't do what you want it to.
- How will you evaluate the function/expression and its derivative at the guessed value?
- What will you do with the improved guess?
- How will you repeat the process to improve the guess?
- How will you stop your program when the guess is good enough?
- What inputs will your program need?
- What local and global variables will your program need?
- Should your output be in decimal or exact format?