0
$\begingroup$

Let $x_1$ and $x_2$ be two real numbers and define the column vector $\mathbf{x}=[x_1,x_2]$. Let $\mathbf{A}_1$ and $\mathbf{A}_2$ be two $2\times 2$ real symmetric matrices. Then I need to plot the surfaces \begin{align} \mathbf{x}^T\mathbf{A}_1\mathbf{x}+1 &\leq 0 \\ \mathbf{x}^T\mathbf{A}_2\mathbf{x}+1 &\leq 0 \end{align}

How do I do this in Mathematica?

$\endgroup$
3
  • $\begingroup$ Please try to write some code. $\endgroup$ Aug 11, 2014 at 4:13
  • $\begingroup$ @belisarius I really want to and I understand it is inappropriate to ask without trying. I come from a matlab & engineering background and doing this in matlab is a pain. Just started with mathematica 2 hrs back. $\endgroup$ Aug 11, 2014 at 5:32
  • $\begingroup$ Well, you've a kickstart below $\endgroup$ Aug 11, 2014 at 16:51

2 Answers 2

4
$\begingroup$
SeedRandom[84];
a = # + Transpose@# &@RandomReal[{0, 1}, {2, 2}];
RegionPlot[{x, y}.a.{x, y} > 0, {x, -2, 2}, {y, -2, 2}]

Mathematica graphics

$\endgroup$
2
  • $\begingroup$ +1, but the condition is $x^TAx+1\le0$, not $x^TAx>0$. $\endgroup$
    – user484
    Aug 11, 2014 at 6:33
  • 2
    $\begingroup$ @RahulNarain Nobody is perfect :) $\endgroup$ Aug 11, 2014 at 7:07
2
$\begingroup$

Using V10 functionality and borrowing from Belisarius:

SeedRandom[84]
a = # + Transpose@# &@RandomReal[{0, 1}, {2, 2}];

We create an ImplicitRegion

region = ImplicitRegion[First[{x, y}.a.{{x}, {y}}] > 0, {x, y}];

And discretize it:

DiscretizeRegion[region, {{-2, 2}, {-2, 2}}]

Mathematica graphics

If you want Frame:

Show[%, PlotRange -> {{-2, 2}, {-2, 2}}, Frame -> True]

Mathematica graphics

$\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.