0
$\begingroup$

I have a list {{1,2,7},{3,4,6},{5,6,2}}. Then, I want to combinate it with itself so:

{{1,2,7},{3,4,6},{5,6,2}} X {{1,2,7},{3,4,6},{5,6,2}}  = newlist= 
{{{1,2,7},{1,2,7}},{{1,2,7},{3,4,6}},{{1,2,7},{5,6,2}},{{3,4,6}, 
{1,2,7}},{{3,4,6},{3,4,6}}......} 

Then I want to apply the next function: (i am gonna make the example with the second element of the newlist)

 (N!/1!2!7!)*(3/3+4+6)^1*(4/3+4+6)^2*(6/3+4+6)^7
$\endgroup$
1
  • 2
    $\begingroup$ If I'm understanding you right, try Tuples[{{1, 2, 7}, {3, 4, 6}, {5, 6, 2}}, {2}], and look up Multinomial[]. $\endgroup$ Mar 21, 2018 at 2:38

1 Answer 1

2
$\begingroup$

It's not clear in the question but from the context I assume you are trying to build a transition matrix.

Assuming that N! was intended to read 3! (where presumably N=3, the dimension of each list) (see N) the following code evaluates to a $3\times 3$ matrix which will subsequently become a transition matrix (in fact, it can be done simultaneously, but I figured it would be better to present the intermediate steps)

(* set up the input *)
x = {{1, 2, 7}, {3, 4, 6}, {5, 6, 2}};

(* produce the matrix and display it *)
y = Outer[f, x, x, 1]

y // MatrixForm

enter image description here

The following function will transform the entries of the preceding matrix into numerical quantities

With[{n = 3!},
  (* note how Factorial threads over lists *)
  f = n/Times @@ Factorial[#1] Times @@ ((#2/Plus @@ #2)^#1) &;
 ]

Now, evaluating

y // N // Chop // MatrixForm

will produce the corresponding transition matrix:

Blockquote

Having said that, it is obvious that the output matrix is not a transition matrix (rows do not sum to 1); this means that my original assumption of what your shorthand calculations were trying to achieve was wrong;

Perhaps more context can be provided; also taking the cue from the question title, DiscreteMarkovProcess might be a relevant resource for you.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.