I need to create two vector lists using table
.
This list contains random numbers that I want to be symmetric.
n = 10;
ξ[i_, j_] :=
With[{z := RandomInteger[j - 1]},
If[i != j, RandomChoice[{z/n, 1 - z/n} -> {1, 0}], 0]];
ρ[j_, i_] := ξ[i,j]
A = Table[
a (Sum[ξ[i, j] Subscript[y, j] Boole[i != j], {j,
n}]) Subscript[x, i], {i, n}]
B = Table[
b (Sum[ρ[j, i] Subscript[x, j] Boole[i != j], {j,
n}]) Subscript[y, i], {i, n}]
The numbers ξ[i_, j_]
and ρ[j_, i_]
are random values symmetric. For example, the random ξ[1,2]=ρ[2,1]
, ξ[1,3]=ρ[3,1_]
... ξ[10,9]=ρ[9,10]
I believe the syntax error is in this line code ρ[j_, i_] := ξ[i, j]
.
Can anybody help me?
\[Rho][i_, j_] := \[Xi][j, i]
instead of\[Rho][j_, i_] := \[Xi][j, i]
. But why don't you useReverse
(such asB = Reverse[A]
)? $\endgroup$xi
(or whatever that letter is) is set delayed, thus gets a new random value every time you use it. therho
then has no symmetry relation toxi
since it also gets newly randomly generated on each use. $\endgroup$m
with all random elements, and then form the matrix(m + Transpose@m)/2
, but perhaps you're looking for something more specific? $\endgroup$ξ[i_, j_] := With[{z := RandomInteger[j - 1]}, If[i != j, RandomChoice[{z/n, 1 - z/n} -> {1, 0}], 0]];
gives random nubers forξ[i_, j_]
equal to zero or one. For example,ξ[1,2] = 1
,ξ[1,3] = 1
,ξ[1,4] = 0
, ` ξ[1,5] = 0, ξ[1,6] = 1` ... I search values forρ
that are symmetric in relation toξ
. For instance:ρ[2,1]=ξ[1,2] = 1
,ρ[3,1]=ξ[1,3] = 1
,ρ[4,1]=ξ[1,4] = 0
,ρ[5,1]=ξ[1,5] = 0
,ρ[6,1]=ξ[1,6] = 1
...Do you have any idea how I can do this operation? $\endgroup$