1.6 Profit from Roundoff Error Accumulation In the 1999 movie Office Space, a ch
ID: 3922793 • Letter: 1
Question
1.6 Profit from Roundoff Error Accumulation In the 1999 movie Office Space, a character creates a program that takes frac- tions of cents that are truncated in a bank's transactions and deposits them into his own account. This is not a new idea, and hackers who have actually attempted it have been arrested. In this exercise, we will simulate the program to determine how long it would take to become a millionaire. account balances to be uniformly distributed between, say S100 adn $100,000. The annual interest rate on the accounts is 5%, and interest is compounded daily and added to the accounts, except that fractions of a cent are truncated.Explanation / Answer
%setup accounts
accounts = 100 + (100000-100)*rand(50000,1);
%truncate each accounts
accounts = floor(100*accounts)/100;
illegal = 0
for i = 1:10000
% adding interest compoundly
illegal = illegal + (sum(accounts)*(0.05/365));
illegal = floor(100*illegal)/100;
%saving data
save('accounts.dat','illegal')
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.