Skip to main content
added 197 characters in body
Source Link
Lukas Lang
  • 34.6k
  • 1
  • 58
  • 99

You need to supply Mathematica with the structure of your variables:

(* dimension of distribution *) n = 2; PDF[ MultinormalDistribution[ Array[Subscript[m, ##] &, n], Array[Subscript[S, Sequence @@ Sort@{##}] &, {n, n}] ], Array[Subscript[x, ##] &, n] ] 

enter image description here We use Array to construct variables of the form Subscript[var,i,j,…] (you can of course use any other form that is more convenient). Note that S is explicitly made symmetric by sorting the indices. The code works without this, but this way there are no "fake" parameters.

Note: As pointed out by @BobHanlon in the comments, Subscript can often cause issues if used blindly. For actual use, it is much safer to simply use indexed variables such as Array[x, n].

You need to supply Mathematica with the structure of your variables:

(* dimension of distribution *) n = 2; PDF[ MultinormalDistribution[ Array[Subscript[m, ##] &, n], Array[Subscript[S, Sequence @@ Sort@{##}] &, {n, n}] ], Array[Subscript[x, ##] &, n] ] 

enter image description here We use Array to construct variables of the form Subscript[var,i,j,…] (you can of course use any other form that is more convenient). Note that S is explicitly made symmetric by sorting the indices. The code works without this, but this way there are no "fake" parameters.

You need to supply Mathematica with the structure of your variables:

(* dimension of distribution *) n = 2; PDF[ MultinormalDistribution[ Array[Subscript[m, ##] &, n], Array[Subscript[S, Sequence @@ Sort@{##}] &, {n, n}] ], Array[Subscript[x, ##] &, n] ] 

enter image description here We use Array to construct variables of the form Subscript[var,i,j,…] (you can of course use any other form that is more convenient). Note that S is explicitly made symmetric by sorting the indices. The code works without this, but this way there are no "fake" parameters.

Note: As pointed out by @BobHanlon in the comments, Subscript can often cause issues if used blindly. For actual use, it is much safer to simply use indexed variables such as Array[x, n].

Source Link
Lukas Lang
  • 34.6k
  • 1
  • 58
  • 99

You need to supply Mathematica with the structure of your variables:

(* dimension of distribution *) n = 2; PDF[ MultinormalDistribution[ Array[Subscript[m, ##] &, n], Array[Subscript[S, Sequence @@ Sort@{##}] &, {n, n}] ], Array[Subscript[x, ##] &, n] ] 

enter image description here We use Array to construct variables of the form Subscript[var,i,j,…] (you can of course use any other form that is more convenient). Note that S is explicitly made symmetric by sorting the indices. The code works without this, but this way there are no "fake" parameters.