# Looking for a tip on a balance calculation

Posted 3 years ago
2865 Views
|
2 Replies
|
2 Total Likes
|
 Hello! I'm looking for some help on a short function I'm writing. I am working on creating a function that given four inputs (principle balance, yearly interest rate, monthly payment, and number of months) and will output a list of the balances of a loan at the end of each payment period. I understand that this is relatively elementary but I am new to Mathematica. Also, this is something I'm creating to learn more about mathematica for a course, so I am not looking to have my code written/edited for me. If someone can explain to me what is wrong with my logic or syntax I'd very much appreciate it. A screenclip of my function is below.
2 Replies
Sort By:
Posted 3 years ago
 I can't see syntax errors. I would use lower-case letters for symbols, so that I am sure they don't conflict with built-in functions. You have an opportunity to use NestList: loanBalanceCalculation2[principal_, yearlyRate_, payment_, months_] := NestList[# + yearlyRate/(12*100) # - payment &, principal, months]