Message Boards Message Boards

0
|
5578 Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Looking for a tip on a balance calculation

Posted 8 years ago

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.

enter image description here

POSTED BY: stephen hong
2 Replies

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]
POSTED BY: Gianluca Gorni

Those parenthesis look suspiciously large. Why don't you select the cell and convert it to InputForm (Cell->Convert->InputForm) and see what you get? In any case you should really be using lower case variables and Module[{owed}, (...etc..) ] instead of the parenthesis.

POSTED BY: Gustavo Delfino
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract