Professional Documents
Culture Documents
Suppose that an object can be at any one of the N +1 equally spaced points, x0 , x1 , x2 , . . . , xN .
If an object is at location xi , it has a probability of α to move to xi−1 , 1 − α to move to xi+1 and
cannot move directly to any other location. Consider the probabilities, Pi for n = 0, 1, . . . , N ,
that an object starting at location xi will reach the left end point before reaching right end point.
In other words, P0 = 1 and PN = 0. Since the object can move to xi only from xi−1 or xi+1 with
probability of α or (1 − α) from each of these locations,
is the linear system of equations for this problem by embedding the known values P0 = 1 and
PN = 0. Here, A is the coefficient matrix in the size of (N − 1) × (N − 1). P and B are the
unknown and right-hand-side vectors, respectively, in the length of (N − 1).
b) Write a computer program that solves this problem for any α and N using Gauss elimination.
Your code must
c) Counting the number of floating point operations in your implementation, show that arith-
metic complexity of Gauss elimination algorithm for this system can be reduced to O(N − 1).
Note that arithmetic complexity of Gauss elimination for general dense matrices of size n × n
is O(n3 ).
• Your code should include "input.txt", "Gauss.ext" and your main file, "e123456.ext" in the
same folder. The input file should include the value of α and N . A sample input file can be
as follows
do not include this column, it is just for information
0.4 α
100 N
• After the execution, your code ("e123456.ext") should read input file, perform required
operation to form the linear system to be solved, call "Gauss.ext" function and create "out-
put.txt". The output file includes point-wise solutions (i.e. at x1 , x2 , . . . , N − 1) obtained
from Gauss elimination process. A sample output file can be as follows:
Point Gauss Elimination do not include this row, it is just for information
1 0.66667
2 0.44444
3 0.29630
.. ..
. .
• In addition to created output file, the α value and the number of points, N should be
printed to the computer screen.
• Present your results in a short report (a few pages of a word document only, saved as a pdf
document) which should include the following: