Workshop 2007 JRE Java Support
Java Applets

This homework may take you some time if you are somewhat inexperienced with coding and/or with java. But it illustrates some of the important concepts in the second part of the workshop.


Write code to implement Newton’s method to find the roots of the function a.  Your program should take an initial guess from the applet when clicking a button, find the root, and output the answer to a label.  Note that Newtons’ method generates a sequence that converges to the root of the given function if the initial guess is “close enough.”  This sequence is generated by the recurrence relationship


Your code should have two methods—one  for the function a and another for its derivative. You will also need to decide when to stop looking for the root. One reasonable criteria is to check and see if a is less than a tolerance of, say, a.(Java accepts scientific notation and so a).  Also, you will probably want to use a while loop to implement Newton’s method.  See Appendix 1 for the format of these loops.


See Sample Code 6 to check work


Homework 2