-- I shall start the loans model by putting a borrowing term into the equation for total_cash_at_end_of_period. This records the amount actually borrowed in each period, and is calculated from the amount the user wants to borrow. To hold these amounts, I need two more tables:[ P | N ]
table want_to_borrow_during_period : time_span → currency.
table actually_borrowed_during_period : time_span → currency.
-- want_to_borrow_during_period[t] is the amount the user wants to borrow during period t.
-- actually_borrowed_during_period[t] is the amount the loans enable the user to borrow, taking borrowing limits into account. This will be less than or equal to want_to_borrow_during_period[t]. In this first version of the model, I just make them equal.
total_cash_at_end_of_period[ t ] =
total_cash_at_start_of_period[ t ] - expenses_during_period[ t ] +
actually_borrowed_during_period[ t ].
actually_borrowed_during_period[ t ] =
want_to_borrow_during_period[ t ].