Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm facing the following problem and would very much like you help. Thanks is advance!

I have defined the following 4x4 matrix: \begin{equation} S=\left( \begin{array}{cccc} \frac{1}{r^2} & 1 & 1 & t\sqrt{x}\\ 1 & \frac{1}{t^2} & 1 & \frac{\sqrt{x}}{t}\\ 1 & 1 & 1 & \sqrt{q} \\ t\sqrt{x} & \frac{\sqrt{x}}{t} & \sqrt{q} & 1 \end{array} \right). \end{equation} where $(t,r)$ are two parameters (which I can choose arbitrarily to be any value in the segment $(0,1]$) and $(x,q)$ are the variables (each over the domain $[0,1]$).

Now, for a fixed pair of $(r,t)$ I want to plot a region of $(x,q)$ over which the matrix $S$ is positive semi-definite (I want it to be a valid covariance matrix). The thing is that when I try to use the Manipulate function (manipulation on $(r,t)\in(0,1]^2$), and plotting the region of $(x,t)$, nothing shows. Namely, Iv'e written the following:

S={{1/r^2, 1, 1, t Sqrt[x]}, {1, 1/t^2, 1, Sqrt[x]/t}, 
   {1, 1, 1, Sqrt[q]}, {t Sqrt[x], Sqrt[x]/t, Sqrt[q], 1}};

Manipulate[
  RegionPlot[PositiveDefiniteMatrixQ[S], 
             {x, 0, 1}, {q, 0, 1}], {r, 0, 1}, {t, 0, 1}]

and I get an empty graph no matter what values I set for $(r,t)$. You might say that maybe this matrix is never positive semi-definite, but the strange this is that if I manually input numerical values to $(r,t)$ and plot the region, everything works fine.

I really need to manipulate over all possible parameter value of $(r,t)$. What is wrong here and how can I fix it?

Moreover, is it possible for Mathematica to parametrically find a local minima of a certain function (of the variable $q$ where $(r,t,x)$ serve as parameters) subject to the constraint that the above matrix must be positive semi-definite? If so, it would very much help me to know how to formalize such a command.

share|improve this question
1  
Same problem as in mathematica.stackexchange.com/questions/25087/… and many others. –  Sjoerd C. de Vries Jul 16 '13 at 22:47
add comment

1 Answer

up vote 5 down vote accepted

Try to define your matrix as a function of $(x,q,r,t)$ variables

S[x_, q_, r_, t_] := {{1/r^2, 1, 1, t Sqrt[x]}, {1, 1/t^2, 1, Sqrt[x]/t}, {1, 1, 1, Sqrt[q]}, {t Sqrt[x], Sqrt[x]/t, Sqrt[q], 1}};

Then Manipulate does what you want

Manipulate[
 RegionPlot[
  PositiveDefiniteMatrixQ@S[x, q, r, t], {x, 0, 1}, {q, 0, 1}],
   {{r, 1/2}, 0, 1}, {{t, 1/2}, 0, 1}]

enter image description here

share|improve this answer
    
Great! thank you very much. How about the minimization problem? Is it possible to do what I want? –  Ziv Goldfeld Jul 16 '13 at 9:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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