AMATH_383_Solution_2 - #2 Winter2010 Problem1 To reproduce...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
AMATH 383 Solution to Assignment #2 Winter 2010 Problem 1 To reproduce Table 3.3, it is important to be able to specify the number of decimal places used in the calculation, not the number of decimal places displayed. In Excel one can use the truncation command TRUNC. Typo: A digit 3 is missing in the entry for year 44. The following MATLAB 7.8.0 function with the input of 58,000 will produce the output: %Exapmle problem, p.64 in Topics in Mathematical Modeling, K.K.Tung %Author: Sasha Malinsky, February 2010. function R=comp(D) %D is the amount of deposit %Set up the output vector and input initial deposit R(1:46,1:3)=0; R(1,2)=D; R(1,3)=R(1,2); %Normalize Deposit to $1e10^6 p9=D/10^6; p10=p9; %MAIN ITERATION for n=1:45 %Index rows in output array n+1 %compute the next balance with the requisite precision p9=fix(p9*(4-3*p9)*10^9)/10^9; p10=fix(p10*(4-3*p10)*10^10)/10^10; %Output R(n+1,1)=n; R(n+1,2)=p9*10^6; R(n+1,3)=p10*10^6; end OUTPUT: Balance = 0 58000 58000 1 221908 221908 2 739902.518 739902.5186 3 1317242.863 1317242.8633 4 63585.171 63585.1704 5 242211.462 242211.4599 6 792846.671 792846.6656 7 1285569.152 1285569.1569 8 184212.474 184212.456 9 635047.189 635047.1371 10 1330333.959 1330333.9493 11 11970.508 11970.5472 12 47452.152 47452.3067 13 183053.487 183054.0625 14 631688.21 631689.8806 15 1329662.856 1329663.2066 16 14641.492 14640.0974 17 57922.848 57917.3922 18 221626.223 221606.2958 19 739150.343 739097.1321 20 1317571.683 1317594.8163 21 62301.312 62210.9653 22 237560.887 237233.2485 23 780938.022 780094.1514
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/21/2011 for the course APPLIED MA AMATH 383 taught by Professor Hongqian during the Spring '10 term at University of Washington.

Page1 / 3

AMATH_383_Solution_2 - #2 Winter2010 Problem1 To reproduce...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online