1 /*******************************************************************************
3 * Examples for the finance
5 ******************************************************************************/
10 (load("finance.mac"),'done);
16 days360(2008,12,16,2007,3,25);
25 annuity_pv(0.12,5000,10);
29 annuity_fv(0.12,65000,10);
32 block([s: make_string_output_stream()],
33 with_stdout(s, amortization(0.05,56000,3)),
34 get_output_stream_string(s));
35 " \"n\" \"Balance\" \"Interest\" \"Amortization\" \"Payment\"
36 0.000 56000.000 0.000 0.000 0.000
37 1.000 38236.320 2800.000 17763.680 20563.680
38 2.000 19584.457 1911.816 18651.864 20563.680
39 3.000 0.000 979.223 19584.457 20563.680
42 block([s: make_string_output_stream()],
43 with_stdout(s, arit_amortization(0.05,1000,56000,3)),
44 get_output_stream_string(s));
45 " \"n\" \"Balance\" \"Interest\" \"Amortization\" \"Payment\"
46 0.000 56000.000 0.000 0.000 0.000
47 1.000 39203.807 2800.000 16796.193 19596.193
48 2.000 20567.803 1960.190 18636.003 20596.193
49 3.000 0.000 1028.390 20567.803 21596.193
52 block([s: make_string_output_stream()],
53 with_stdout(s, geo_amortization(0.05,0.03,56000,3)),
54 get_output_stream_string(s));
55 " \"n\" \"Balance\" \"Interest\" \"Amortization\" \"Payment\"
56 0.000 56000.000 0.000 0.000 0.000
57 1.000 38821.880 2800.000 17178.120 19978.120
58 2.000 20185.511 1941.094 18636.369 20577.463
59 3.000 0.000 1009.276 20185.511 21194.787
62 geo_annuity_pv(0.14,0.05,5000,10);
65 geo_annuity_fv(0.14,0.05,5000,10);
68 block([l: [100,500,323,124,300],
70 ref: block([s], (s: 0, for n thru length(l) do s: s + l[n]/(1+r)^(n-1), s)),
74 (res:irr([-5000,0,800,1300,1500,2000],0), rhs(res[1][1]));
77 benefit_cost(0.24,[0,300,500,150],[100,320,0,180]);
80 (reset(fpprec), 'done);