Solutions for Tutorial 1:
Physical memory of matrix A:
A(1,1) | A(1,2) | A(1,3) | A(1,4) | A(1,5) | A(1,6) | A(1,7) | A(1,8) | A(1,9) | A(1,10) |
A(2,1) | A(2,2) | A(2,3) | A(2,4) | A(2,5) | A(2,6) | A(2,7) | A(2,8) | A(2,9) | A(2,10) |
A(3,1) | A(3,2) | A(3,3) | A(3,4) | A(3,5) | A(3,6) | A(3,7) | A(3,8) | A(3,9) | A(3,10) |
A(4,1) | A(4,2) | A(4,3) | A(4,4) | A(4,5) | A(4,6) | A(4,7) | A(4,8) | A(4,9) | A(4,10) |
A(5,1) | A(5,2) | A(5,3) | A(5,4) | A(5,5) | A(5,6) | A(5,7) | A(5,8) | A(5,9) | A(5,10) |
A(6,1) | A(6,2) | A(6,3) | A(6,4) | A(6,5) | A(6,6) | A(6,7) | A(6,8) | A(6,9) | A(6,10) |
A(7,1) | A(7,2) | A(7,3) | A(7,4) | A(7,5) | A(7,6) | A(7,7) | A(7,8) | A(7,9) | A(7,10) |
A(8,1) | A(8,2) | A(8,3) | A(8,4) | A(8,5) | A(8,6) | A(8,7) | A(8,8) | A(8,9) | A(8,10) |
A(9,1) | A(9,2) | A(9,3) | A(9,4) | A(9,5) | A(9,6) | A(9,7) | A(9,8) | A(9,9) | A(9,10) |
A(10,1) | A(10,2) | A(10,3) | A(10,4) | A(10,5) | A(10,6) | A(10,7) | A(10,8) | A(10,9) | A(10,10) |
A(1,1) | A(1,2) | A(1,3) | A(1,4) | A(1,5) | A(1,6) | ____ | ____ | ____ | ____ |
A(2,1) | A(2,2) | A(2,3) | A(2,4) | A(2,5) | A(2,6) | _ | _ | _ | _ |
A(3,1) | A(3,2) | A(3,3) | A(3,4) | A(3,5) | A(3,6) | _ | _ | _ | _ |
A(4,1) | A(4,2) | A(4,3) | A(4,4) | A(4,5) | A(4,6) | _ | _ | _ | _ |
A(5,1) | A(5,2) | A(5,3) | A(5,4) | A(5,5) | A(5,6) | _ | _ | _ | _ |
__ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
_ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
_ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
_ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
_ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
Near minimum:
f(x) ~ f(xmin) + 1/2 f"(xmin) (x - xmin)2Because f(x)-f(xmin) approaches machine precision at minimum, we have the following relation:
e ~ f(x) - f(xmin) ~ 1/2 f"(xmin) (dxmin)2because 1/2 f"(xmin) is a constant, it becomes:
e ~ (dxmin)2That is:dxmin ~ e1/2 = O(e1/2)
Answer:
Method 1 unsuitable, the first digit is biased
to the local number.
Method 2 suitable if there is no bias in selecting a
page.
Method 3 suitable
Method 4 suitable
Method 5 unsuitable, impossible to read the watch at
random times.
Method 6 unsuitble, bias in thinking the number.
Solution:
Linear congruential method:Xn+1 = (a Xn + c) mod m
For m=10 and X0=a=c=7
X0 = 7For m=30 and X0=a=c=14
X1 = (7 * 7 + 7) mod 10 = 6
X2 = (7 * 6 + 7) mod 10 = 9
X3 = (7 * 9 + 7) mod 10 = 0
X4 = (7 * 0 + 7) mod 10 = 7
X5 = (7 * 7 + 7) mod 10 = 6
X6 = (7 * 6 + 7) mod 10 = 9
X7 = (7 * 9 + 7) mod 10 = 0
X0=14
X1=(14 * 14 + 14) mod 30 = 0
X2=(14 * 0 + 14) mod 30 = 14
X3=(14 * 14 + 14) mod 30 = 0