Symbolic Multivariate Distribution












1












$begingroup$


If I try to input a symbolic multivariate distribution, I do not get a useful result.



PDF[MultinormalDistribution[m, S], x]

(* During evaluation of MultinormalDistribution::vrprm: The value m at position 1 in MultinormalDistribution[m,S] is expected to be a list of real numbers. *)

(* During evaluation of MultinormalDistribution::vrprm: The value m at position 1 in MultinormalDistribution[m,S] is expected to be a list of real numbers.*)
(* PDF[MultinormalDistribution[m, S], x] *)


Clearly, Mathematica could return an appropriate symbolic expression. Is there any way of making it do so?










share|improve this question









$endgroup$

















    1












    $begingroup$


    If I try to input a symbolic multivariate distribution, I do not get a useful result.



    PDF[MultinormalDistribution[m, S], x]

    (* During evaluation of MultinormalDistribution::vrprm: The value m at position 1 in MultinormalDistribution[m,S] is expected to be a list of real numbers. *)

    (* During evaluation of MultinormalDistribution::vrprm: The value m at position 1 in MultinormalDistribution[m,S] is expected to be a list of real numbers.*)
    (* PDF[MultinormalDistribution[m, S], x] *)


    Clearly, Mathematica could return an appropriate symbolic expression. Is there any way of making it do so?










    share|improve this question









    $endgroup$















      1












      1








      1





      $begingroup$


      If I try to input a symbolic multivariate distribution, I do not get a useful result.



      PDF[MultinormalDistribution[m, S], x]

      (* During evaluation of MultinormalDistribution::vrprm: The value m at position 1 in MultinormalDistribution[m,S] is expected to be a list of real numbers. *)

      (* During evaluation of MultinormalDistribution::vrprm: The value m at position 1 in MultinormalDistribution[m,S] is expected to be a list of real numbers.*)
      (* PDF[MultinormalDistribution[m, S], x] *)


      Clearly, Mathematica could return an appropriate symbolic expression. Is there any way of making it do so?










      share|improve this question









      $endgroup$




      If I try to input a symbolic multivariate distribution, I do not get a useful result.



      PDF[MultinormalDistribution[m, S], x]

      (* During evaluation of MultinormalDistribution::vrprm: The value m at position 1 in MultinormalDistribution[m,S] is expected to be a list of real numbers. *)

      (* During evaluation of MultinormalDistribution::vrprm: The value m at position 1 in MultinormalDistribution[m,S] is expected to be a list of real numbers.*)
      (* PDF[MultinormalDistribution[m, S], x] *)


      Clearly, Mathematica could return an appropriate symbolic expression. Is there any way of making it do so?







      probability-or-statistics symbolic






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 hours ago









      mikadomikado

      6,9321929




      6,9321929






















          1 Answer
          1






          active

          oldest

          votes


















          4












          $begingroup$

          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].






          share|improve this answer











          $endgroup$













          • $begingroup$
            Rather than using subscripted variables, I recommend using indexed variables and then using Format to display the indexed variables as subscripted variables. Subscripted variables tend to cause problems in solvers.
            $endgroup$
            – Bob Hanlon
            26 mins ago










          • $begingroup$
            I am aware of that - I just thought that for a quick demonstration, it would be good enough and it's easy to read. But I will add a comment to the answer to point out potential issues.
            $endgroup$
            – Lukas Lang
            22 mins ago












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "387"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f197180%2fsymbolic-multivariate-distribution%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4












          $begingroup$

          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].






          share|improve this answer











          $endgroup$













          • $begingroup$
            Rather than using subscripted variables, I recommend using indexed variables and then using Format to display the indexed variables as subscripted variables. Subscripted variables tend to cause problems in solvers.
            $endgroup$
            – Bob Hanlon
            26 mins ago










          • $begingroup$
            I am aware of that - I just thought that for a quick demonstration, it would be good enough and it's easy to read. But I will add a comment to the answer to point out potential issues.
            $endgroup$
            – Lukas Lang
            22 mins ago
















          4












          $begingroup$

          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].






          share|improve this answer











          $endgroup$













          • $begingroup$
            Rather than using subscripted variables, I recommend using indexed variables and then using Format to display the indexed variables as subscripted variables. Subscripted variables tend to cause problems in solvers.
            $endgroup$
            – Bob Hanlon
            26 mins ago










          • $begingroup$
            I am aware of that - I just thought that for a quick demonstration, it would be good enough and it's easy to read. But I will add a comment to the answer to point out potential issues.
            $endgroup$
            – Lukas Lang
            22 mins ago














          4












          4








          4





          $begingroup$

          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].






          share|improve this answer











          $endgroup$



          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].







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 18 mins ago

























          answered 2 hours ago









          Lukas LangLukas Lang

          7,43011032




          7,43011032












          • $begingroup$
            Rather than using subscripted variables, I recommend using indexed variables and then using Format to display the indexed variables as subscripted variables. Subscripted variables tend to cause problems in solvers.
            $endgroup$
            – Bob Hanlon
            26 mins ago










          • $begingroup$
            I am aware of that - I just thought that for a quick demonstration, it would be good enough and it's easy to read. But I will add a comment to the answer to point out potential issues.
            $endgroup$
            – Lukas Lang
            22 mins ago


















          • $begingroup$
            Rather than using subscripted variables, I recommend using indexed variables and then using Format to display the indexed variables as subscripted variables. Subscripted variables tend to cause problems in solvers.
            $endgroup$
            – Bob Hanlon
            26 mins ago










          • $begingroup$
            I am aware of that - I just thought that for a quick demonstration, it would be good enough and it's easy to read. But I will add a comment to the answer to point out potential issues.
            $endgroup$
            – Lukas Lang
            22 mins ago
















          $begingroup$
          Rather than using subscripted variables, I recommend using indexed variables and then using Format to display the indexed variables as subscripted variables. Subscripted variables tend to cause problems in solvers.
          $endgroup$
          – Bob Hanlon
          26 mins ago




          $begingroup$
          Rather than using subscripted variables, I recommend using indexed variables and then using Format to display the indexed variables as subscripted variables. Subscripted variables tend to cause problems in solvers.
          $endgroup$
          – Bob Hanlon
          26 mins ago












          $begingroup$
          I am aware of that - I just thought that for a quick demonstration, it would be good enough and it's easy to read. But I will add a comment to the answer to point out potential issues.
          $endgroup$
          – Lukas Lang
          22 mins ago




          $begingroup$
          I am aware of that - I just thought that for a quick demonstration, it would be good enough and it's easy to read. But I will add a comment to the answer to point out potential issues.
          $endgroup$
          – Lukas Lang
          22 mins ago


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Mathematica Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f197180%2fsymbolic-multivariate-distribution%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Category:香港粉麵

          List *all* the tuples!

          Channel [V]