File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Newton Rapson library for APR calculator in JAVA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Newton Rapson library for APR calculator in JAVA" Watch "Newton Rapson library for APR calculator in JAVA" New topic

Newton Rapson library for APR calculator in JAVA

Shailesh Kulkarni

Joined: Feb 11, 2005
Posts: 11
Hello Everyody,

I want to write Java programme by using formula


and using Newton rapson method (a(1+a)N/(1+a)N-1)- (p/c)=0
where N is raise to value.

C=Loan Amount
E=Extra Cost
R=Interest Rate
N=Number of months

This calculator first calculates the monthly payment using C+E and the original interest rate r = R/1200:

The APR (a = A/1200) is then calculated iteratively by solving the following equation using the Newton-Raphson method:

Is there any libriry in java for Newton rapson method. Or any help is same kind of work. Plz guide me ..!! Its urgent ..!!
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
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.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
I agree. Here's the link:
subject: Newton Rapson library for APR calculator in JAVA
It's not a secret anymore!