johnmpl
Board Regular
- Joined
- Jun 14, 2013
- Messages
- 237
- Office Version
- 365
- Platform
- Windows
Hi to all!
I bring you a challenge to do without the help of macros or Excel tools (like Solver). The idea is to use only Excel formulation, and, if possible, use the same formulation for the entire matrix.
What is needed is to be able to generate a square matrix n x n that results in sum of each of its columns some specific values defined by a given resultant vector.
There are some conditions (restrictions) that must be met:
1. Each value of the matrix must be between 0 and 1, including the extremes (it can be 0 and / or 1 the result).
2. The values of the main diagonal must always be 0.
f1c1, f2c2, ..., fncn = 0
3. The sum of the opposite values between row and column must always be 1. For example
f2c1 + f1c2 = 1
f3c1 + f1c3 = 1
...
f3c2 + f2c3 = 1
f4c2 + f2c4 = 1
...
and so on.
4. Values should not be negative (clearly this condition is only for clarity, due to condition 1 that includes it).
Possibly several solutions are found to the problem, but just one solution is needed that satisfies all the given conditions. The example given below satisfies all restrictions.
n = 7
[TABLE="width: 378"]
<colgroup><col span="7"></colgroup><tbody>[TR]
[TD]0,0[/TD]
[TD]0,3[/TD]
[TD]0,3[/TD]
[TD]0,3[/TD]
[TD]0,4[/TD]
[TD]0,0[/TD]
[TD]0,1[/TD]
[/TR]
[TR]
[TD]0,7[/TD]
[TD]0,0[/TD]
[TD]0,5[/TD]
[TD]0,5[/TD]
[TD]0,6[/TD]
[TD]0,1[/TD]
[TD]0,2[/TD]
[/TR]
[TR]
[TD]0,7[/TD]
[TD]0,5[/TD]
[TD]0,0[/TD]
[TD]0,5[/TD]
[TD]0,6[/TD]
[TD]0,1[/TD]
[TD]0,2[/TD]
[/TR]
[TR]
[TD]0,7[/TD]
[TD]0,5[/TD]
[TD]0,5[/TD]
[TD]0,0[/TD]
[TD]0,4[/TD]
[TD]0,2[/TD]
[TD]0,3[/TD]
[/TR]
[TR]
[TD]0,6[/TD]
[TD]0,4[/TD]
[TD]0,4[/TD]
[TD]0,6[/TD]
[TD]0,0[/TD]
[TD]0,0[/TD]
[TD]0,1[/TD]
[/TR]
[TR]
[TD]1,0[/TD]
[TD]0,9[/TD]
[TD]0,9[/TD]
[TD]0,8[/TD]
[TD]1,0[/TD]
[TD]0,0[/TD]
[TD]0,7[/TD]
[/TR]
[TR]
[TD]0,9[/TD]
[TD]0,8[/TD]
[TD]0,8[/TD]
[TD]0,7[/TD]
[TD]0,9[/TD]
[TD]0,3[/TD]
[TD]0,0[/TD]
[/TR]
</tbody>[/TABLE]
Given Vector:
[TABLE="width: 378"]
<tbody>[TR]
[TD="class: xl65, width: 54"]4,6[/TD]
[TD="class: xl65, width: 54"]3,4[/TD]
[TD="class: xl65, width: 54"]3,4[/TD]
[TD="class: xl65, width: 54"]3,4[/TD]
[TD="class: xl65, width: 54"]3,9[/TD]
[TD="class: xl65, width: 54"]0,7[/TD]
[TD="class: xl65, width: 54"]1,6[/TD]
[/TR]
</tbody>[/TABLE]
Any help will be appreciated. Blessings!
I bring you a challenge to do without the help of macros or Excel tools (like Solver). The idea is to use only Excel formulation, and, if possible, use the same formulation for the entire matrix.
What is needed is to be able to generate a square matrix n x n that results in sum of each of its columns some specific values defined by a given resultant vector.
There are some conditions (restrictions) that must be met:
1. Each value of the matrix must be between 0 and 1, including the extremes (it can be 0 and / or 1 the result).
2. The values of the main diagonal must always be 0.
f1c1, f2c2, ..., fncn = 0
3. The sum of the opposite values between row and column must always be 1. For example
f2c1 + f1c2 = 1
f3c1 + f1c3 = 1
...
f3c2 + f2c3 = 1
f4c2 + f2c4 = 1
...
and so on.
4. Values should not be negative (clearly this condition is only for clarity, due to condition 1 that includes it).
Possibly several solutions are found to the problem, but just one solution is needed that satisfies all the given conditions. The example given below satisfies all restrictions.
n = 7
[TABLE="width: 378"]
<colgroup><col span="7"></colgroup><tbody>[TR]
[TD]0,0[/TD]
[TD]0,3[/TD]
[TD]0,3[/TD]
[TD]0,3[/TD]
[TD]0,4[/TD]
[TD]0,0[/TD]
[TD]0,1[/TD]
[/TR]
[TR]
[TD]0,7[/TD]
[TD]0,0[/TD]
[TD]0,5[/TD]
[TD]0,5[/TD]
[TD]0,6[/TD]
[TD]0,1[/TD]
[TD]0,2[/TD]
[/TR]
[TR]
[TD]0,7[/TD]
[TD]0,5[/TD]
[TD]0,0[/TD]
[TD]0,5[/TD]
[TD]0,6[/TD]
[TD]0,1[/TD]
[TD]0,2[/TD]
[/TR]
[TR]
[TD]0,7[/TD]
[TD]0,5[/TD]
[TD]0,5[/TD]
[TD]0,0[/TD]
[TD]0,4[/TD]
[TD]0,2[/TD]
[TD]0,3[/TD]
[/TR]
[TR]
[TD]0,6[/TD]
[TD]0,4[/TD]
[TD]0,4[/TD]
[TD]0,6[/TD]
[TD]0,0[/TD]
[TD]0,0[/TD]
[TD]0,1[/TD]
[/TR]
[TR]
[TD]1,0[/TD]
[TD]0,9[/TD]
[TD]0,9[/TD]
[TD]0,8[/TD]
[TD]1,0[/TD]
[TD]0,0[/TD]
[TD]0,7[/TD]
[/TR]
[TR]
[TD]0,9[/TD]
[TD]0,8[/TD]
[TD]0,8[/TD]
[TD]0,7[/TD]
[TD]0,9[/TD]
[TD]0,3[/TD]
[TD]0,0[/TD]
[/TR]
</tbody>[/TABLE]
Given Vector:
[TABLE="width: 378"]
<tbody>[TR]
[TD="class: xl65, width: 54"]4,6[/TD]
[TD="class: xl65, width: 54"]3,4[/TD]
[TD="class: xl65, width: 54"]3,4[/TD]
[TD="class: xl65, width: 54"]3,4[/TD]
[TD="class: xl65, width: 54"]3,9[/TD]
[TD="class: xl65, width: 54"]0,7[/TD]
[TD="class: xl65, width: 54"]1,6[/TD]
[/TR]
</tbody>[/TABLE]
Any help will be appreciated. Blessings!