Luc, It's not clear to me that I could. See another email I just sent for the approximate formula. I think Newton-Raphson or Bisection can be used to solve the non-linear part but I don't know how. -Dave -----Original Message----- From: Luc Maisonobe [mailto:Luc.Maisonobe@free.fr] Sent: Saturday, August 16, 2008 3:45 PM To: Commons Users List Subject: Re: commons-math usage to calculate APR? David Hoffer a écrit : > My usage is for USA only at this point. > > I have inputs of loanAmount, monthlyInterestRate, numberMonths, loanFees; so > this would be for fixed monthly payments. You can try this (considering monthlyInterestRate is a number between 0.0 and 1.0, i.e. percent values have already been divided by 100.0, and considering the loanFees are fixed monthly fees): public double getMonthlyPayment(final double loanAmount, final double monthlyInterestRate, final int numberMonths, final double loanFees) { final double f = Math.pow(1 + monthlyInterestRate, numberMonths); return loanFees + monthlyInterestRate * f * loanAmount / (f - 1); } Could you compute the APR from this monthly payment ? Luc > > I understand that commons-math doesn't have specific finance methods however > I think the APR formula is a non-linear equation that I was hoping > commons-math could help solve. > > -Dave > > -----Original Message----- > From: Luc Maisonobe [mailto:Luc.Maisonobe@free.fr] > Sent: Saturday, August 16, 2008 2:45 PM > To: Commons Users List > Subject: Re: commons-math usage to calculate APR? > > David Hoffer a écrit : >> Can anyone point me to an example of how to use commons-math to calculate >> APR (Annual Percentage Rate)? > > There are no specific finance related algorithm in commons-math. > >> I think this is solvable using either the NewtonSolver or BisectionSolver >> but I am not sure how to accomplish this. Perhaps a different way is >> better. > > I think so, but it depends on what you really need. APR computation > seems to be slightly different depending on local regulations (for > example USA or EU). It also depends on the assumptions you do and the > input data. For example you can compute it one way for fixed monthly > payments and another way for varying monthly payments. > >> Any help would be greatly appreciated. > > Could you explain your needs more precisely ? > > Luc > >> Thanks. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org >> For additional commands, e-mail: user-help@commons.apache.org >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org