I am running a gamblers problem solution where I am testing the timing involved in solving the Ax = b equation for matrices of n=100, 1000, 10000, and 100000. For some reason I keep getting the same time (0.015625 seconds) for the time, but I know it takes many more seconds than this. The matrix for n=100000 ran for probably 20 mins and still returned 0.015625.
My process to create the matrix is basically:
A = IdentityMatrix[100000, SparseArray];
For[i = 2, i < 100000, i++,
A[[i, i]] = -1;
A[[i, i - 1]] = .5;
A[[i, i + 1]] = .5
];
The vector is created by:
b = {1};
For[i = 2, i <= 100000, i++, b = Insert[b, 0, -1] ];
Then I run:
Timing[LinearSolve[A, b]]
matrixSize
,vectorSize
andcoefficientMatrix
? $\endgroup$ – Henrik Schumacher Mar 14 '19 at 22:34AbsoluteTiming
instead ofTiming
? $\endgroup$ – Michael E2 Mar 14 '19 at 22:42