7
$\begingroup$

I have the following variables

Σ = {{64, 40.8, 80}, {40.8, 289, 238}, {80, 238, 400}};
μ = {{9}, {12}, {15}};
ι = {{1}, {1}, {1}};

And then I define the following matrix:

A = {{Transpose[μ].Inverse[Σ].μ, 
Transpose[μ].Inverse[Σ].ι}, {Transpose[μ].Inverse[Σ].ι, 
Transpose[ι].Inverse[Σ].ι}};

Which gives me the matrix:

enter image description here

Now when I try to get the determinant of the matrix i get an error: enter image description here

Any1 know what the problem is?

$\endgroup$
1
  • $\begingroup$ Det will take the determinant of a symbolic matrix, so you could also use something like Det[A] /. {\[CapitalSigma] -> {{64, 40.8, 80}, {40.8, 289, 238}, {80, 238, 400}}, \[Mu] -> {9, 12, 15}, \[Iota] -> {1, 1, 1}} with A as defined below by Bob Hanlon (mathematica.stackexchange.com/a/148259/106) $\endgroup$
    – user1066
    Jun 13, 2017 at 14:34

3 Answers 3

11
$\begingroup$

Mathematica does not distinguish between row and column vectors ("The Wolfram Language represents vectors as lists, and never needs to distinguish between row and column cases."). Consequently, change your definitions of μ, ι, and A.

Σ = {{64, 40.8, 80}, {40.8, 289, 238}, {80, 238, 400}};
μ = {9, 12, 15};
ι = {1, 1, 1};

(A = {{μ.Inverse[Σ].μ, μ.Inverse[Σ].ι}, 
  {μ.Inverse[Σ].ι, ι.Inverse[Σ].ι}}) // MatrixForm

enter image description here

Det[A]

0.0021282
$\endgroup$
5
$\begingroup$

The problem is the structure of A. You need to use Flatten and First to get rid of the curly around each number.

Σ = {{64, 40.8, 80}, {40.8, 289, 238}, {80, 238, 400}};
μ = {{9}, {12}, {15}};
ι = {{1}, {1}, {1}};

A = {{First@Flatten[Transpose[μ].Inverse[Σ].μ], 
   First@Flatten[Transpose[μ].Inverse[Σ].ι]}, {First@
    Flatten[Transpose[μ].Inverse[Σ].ι], 
   First@Flatten[Transpose[ι].Inverse[Σ].ι]}};

A // TraditionalForm

Blockquote

Det[A]

0.0021282

$\endgroup$
4
$\begingroup$

What you have constructed is a four-dimensional array (matrix of matrices).

To contruct a normal two-dimensional matrix from two-dimensional blocks use ArrayFlatten:

A = ArrayFlatten[{{Transpose[μ].Inverse[Σ].μ, Transpose[μ].Inverse[Σ].ι}, 
                  {Transpose[μ].Inverse[Σ].ι, Transpose[ι].Inverse[Σ].ι}}];
{{1.41771,  0.151394 }, 
 {0.151394, 0.0176682}}
$\endgroup$

Your Answer

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

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