Class MoneyUtils
java.lang.Object
org.episteme.social.economics.money.MoneyUtils
Utility class for financial calculations using high-precision Real numbers.
Provides methods for computing interest rates, loan payments, and other financial formulas.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic MoneycompoundInterest(Money principal, Real interestRate, int compoundsPerYear, int years) Applies compound interest to a money amount.static RealcompoundInterestFutureValue(Real principal, Real interestRate, int compoundsPerYear, int numberOfYears) Calculates the future value with compound interest.static RealcontinuousInterestFutureValue(Real principal, Real interestRate, int numberOfYears) Calculates future value with continuous compounding.static RealeffectiveAnnualRate(Real nominalRate, int compoundsPerYear) Calculates the effective annual rate (EAR).static RealloanBalance(Real principal, Real annualRate, int paymentsPerYear, int yearsPaid, Real paymentAmount) Calculates the remaining balance on a loan.static RealloanPayment(Real principal, Real interestRate, int numberOfPeriods) Calculates the periodic payment for a loan.static RealloanPrincipal(Real paymentPerPeriod, Real interestRate, int numberOfPeriods) Calculates the maximum loan amount for given payment.static MoneymonthlyMortgagePayment(Money principal, Real annualRate, int years) Calculates monthly mortgage payment.static RealsimpleInterestFutureValue(Real principal, Real interestRate, int numberOfPeriods) Calculates the future value with simple interest.static RealsimpleInterestPeriods(Real principal, Real futureValue, Real interestRate) Calculates the number of periods needed to reach a target.static RealsimpleInterestPresentValue(Real futureValue, Real interestRate, int numberOfPeriods) Calculates the present value for simple interest.static RealsimpleInterestRate(Real principal, Real futureValue, int numberOfPeriods) Calculates the interest rate from initial and final values.static RealtotalInterestPaid(Real principal, Real payment, int numberOfPeriods) Calculates total interest paid over the life of a loan.
-
Method Details
-
simpleInterestFutureValue
public static Real simpleInterestFutureValue(Real principal, Real interestRate, int numberOfPeriods) Calculates the future value with simple interest.- Parameters:
principal- initial depositinterestRate- annual interest rate (as decimal, e.g., 0.05 for 5%)numberOfPeriods- number of periods- Returns:
- the future value
-
simpleInterestPresentValue
public static Real simpleInterestPresentValue(Real futureValue, Real interestRate, int numberOfPeriods) Calculates the present value for simple interest.- Parameters:
futureValue- the target future valueinterestRate- annual interest ratenumberOfPeriods- number of periods- Returns:
- the present value (initial deposit needed)
-
simpleInterestRate
-
simpleInterestPeriods
-
compoundInterestFutureValue
public static Real compoundInterestFutureValue(Real principal, Real interestRate, int compoundsPerYear, int numberOfYears) Calculates the future value with compound interest.- Parameters:
principal- initial depositinterestRate- annual interest ratecompoundsPerYear- number of compounding periods per yearnumberOfYears- number of years- Returns:
- the future value
-
continuousInterestFutureValue
-
effectiveAnnualRate
-
loanPrincipal
Calculates the maximum loan amount for given payment.- Parameters:
paymentPerPeriod- the periodic paymentinterestRate- periodic interest ratenumberOfPeriods- total number of payments- Returns:
- the maximum loan amount
-
loanPayment
-
loanBalance
public static Real loanBalance(Real principal, Real annualRate, int paymentsPerYear, int yearsPaid, Real paymentAmount) Calculates the remaining balance on a loan.- Parameters:
principal- original loan amountannualRate- annual percentage ratepaymentsPerYear- payments per yearyearsPaid- years of payments madepaymentAmount- amount of each payment- Returns:
- the remaining balance
-
totalInterestPaid
-
compoundInterest
public static Money compoundInterest(Money principal, Real interestRate, int compoundsPerYear, int years) Applies compound interest to a money amount.- Parameters:
principal- the initial amountinterestRate- annual interest ratecompoundsPerYear- compounding frequencyyears- number of years- Returns:
- the future value
-
monthlyMortgagePayment
-