I was wondering if anyone could help me out with an assignment. It's related to linear equation systems, and I need to fill in some code and answer a few questions. The part I'm currently stuck on involves determining the value of in the code snippet below:
nList = [3, 30, 300, 3000];
for i=1:length(nList)
n = nList(i);
I = eye(n);
R = rand(n);
k = ?;
A = I - k*R;
C = k*R
Specifically, I'm unsure whether the value of should be set to 1/sum(R(:)) or 1/max(sum(R,1)). The goal is to ensure that the sum of all columns in the matrix C is less than 1.
After some research, I found that 1/sum(R(:)) is correct but too strict, as it would make the sum of the whole matrix equal to 1. On the other hand, 1/max(R(:)) is incorrect because it would make the largest element in equal to 1, but the sum of columns could still exceed 1.
So I was told a better approach would be to use 1/max(sum(R,1)). This calculates the sum of each column in , then divides it by the largest sum, and that if you need the sum to be strictly less than 1, we could subtract a very small number or multiply it by a value slightly less than 1.
If you have any insights or suggestions regarding this issue, I would greatly appreciate your input.