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.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
Author

Newton Rapson library for APR calculator in JAVA

Shailesh Kulkarni
Greenhorn

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

I want to write Java programme by using formula

p=(C+E)r(1+r)N/(1+r)N-1

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.

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
 
Similar Threads
help I am having trouble getting the field to fill in
Mortgage Calculator and GUI
I can't see the error in this page
Java Code for APR Calculation using Newton Rapson Method
extra credit in class but stuck on persentage rates