• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Himai Minh

Newton Rapson library for APR calculator in JAVA

Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ..!!
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Hey! Wanna see my flashlight? It looks like this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic