nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 24 lines 775 B view raw
1% Taken from https://www.minizinc.org/doc-2.7.3/en/modelling.html 2% variables 3var float: R; % quarterly repayment 4var float: P; % principal initially borrowed 5var 0.0 .. 10.0: I; % interest rate (per quarter) 6 7% intermediate variables 8var float: B1; % balance after one quarter 9var float: B2; % balance after two quarters 10var float: B3; % balance after three quarters 11var float: B4; % balance owing at end 12 13constraint B1 = P * (1.0 + I) - R; 14constraint B2 = B1 * (1.0 + I) - R; 15constraint B3 = B2 * (1.0 + I) - R; 16constraint B4 = B3 * (1.0 + I) - R; 17 18solve satisfy; 19 20output [ 21 "Borrowing ", show_float(0, 2, P), " at ", show(I*100.0), 22 "% interest, and repaying ", show_float(0, 2, R), 23 "\nper quarter for 1 year leaves ", show_float(0, 2, B4), " owing\n" 24];