this repo has no description
1% variables
2var float: R; % quarterly repayment
3var float: P; % principal initially borrowed
4var 0.0 .. 10.0: I; % interest rate
5
6% intermediate variables
7var float: B1; % balance after one quarter
8var float: B2; % balance after two quarters
9var float: B3; % balance after three quarters
10var float: B4; % balance owing at end
11
12constraint B1 = P * (1.0 + I) - R;
13constraint B2 = B1 * (1.0 + I) - R;
14constraint B3 = B2 * (1.0 + I) - R;
15constraint B4 = B3 * (1.0 + I) - R;
16
17solve satisfy;
18
19output [
20 "Borrowing ", show_float(0, 2, P), " at ", show(I*100.0),
21 "% interest, and repaying ", show_float(0, 2, R),
22 "\nper quarter for 1 year leaves ", show_float(0, 2, B4), " owing\n"
23];