This week's giveaway is in the Android forum. We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line! See this thread for details.

Well, if you Google for "java newton raphson", you'll get plenty of help. It would be a good idea to try Google (or your favourite search engine) before posting questions.

To solve with Newton-Raphson, you need a way of evaluating the function f(x) and its first derivative f'(x), at any value of the unknown x.

Hopefully, you can do a bit of calculus to work out an analytic function for your derivative. If not, it is possible to estimate the derivative by evaluating the function at two points very close to the current value of the unknown x.

The Newton-Raphson formula tells you what change in x would make f(x) be zero, if the function were linear. If the function is mildly non-linear then repeated application of the formula will often allow you to get close to the true solution.

Newton-Raphson is not a particularly good solver. If this is a homework assignment, I guess you've been told to use it. If it's a real application, you should look for something better. There are probably open-source libraries with various equation-solvers in them (see that Google search again).

One simple modification to pure Newton-Raphson is to limit the size of the step you take in x. This prevents the algorithm from going mad if it reaches a region of very small derivative.

HTH

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.

subject: Newton Rapson library for APR calculator in JAVA