# Plotting area in the plane where two inequalities in two variables hold

I would like to plot the area in the plane where two inequalities hold, both involving two variables. I would like to do it the way Wolfram Alpha does it, but within a LaTeX document. I have looked into the documentation of pgfplots, but I cannot figure out if and how this is possible. Maybe I need a different package, but I have had little success with google.

-
Possible Duplicate: tex.stackexchange.com/questions/37766/… –  Peter Grill Dec 24 '11 at 15:22
–  Peter Grill Dec 24 '11 at 15:23
It is worth visiting tex.stackexchange.com/a/8930/9467 because the solution used fewer keystrokes in PSTricks. –  Please don't touch Dec 24 '11 at 15:46
Since there has been some suggestions pointing to possible duplicates, let us know whether they solve your problem and we'll probably close this question (to keep things tidy). If none of the linked questions solve your problem, edit your question and state why this is the case, and perhaps provide some more information regarding your intended output. –  Werner Dec 24 '11 at 15:56
Hey! No, I had already seen those posts, but they all have the advantage over me that their inequalities are of the kind y < f(x) (i.e. they can isolate the variables). In fact, these inequalities are all linear. The below answer by DJP seems very promising, I will give that a closer look. –  Jesko Hüttenhain Dec 24 '11 at 20:12

There is a package for LaTeX called sagetex which gives you the power of a CAS in your latex documents. I didn't see it mentioned, and since the example you gave involved something more complicated than linear inequalities you might be interested. It's great for problems involving complicated mathematics like what you see on Wolfram Alpha. Look into Sage; this page was especially helpful to me. Include the sagetex package in the preamble:

\documentclass{article}
\usepackage{sagetex}
\begin{document}
\pagestyle{empty}
\begin{sagesilent}
G=Graphics()
H=Graphics()
I=Graphics()
J=Graphics()
var('x,y')
G+=implicit_plot(2*y^2*x-5*y^2+8*y-4*x*y+3*x-2, (x,-2,4), (y,-2,7),color='red')
H+= implicit_plot(3*y^2*x-8*y^2+12*y-6*x*y+4*x-3,(x,-2,4),(y,-2,7),color='black')
I += region_plot([2*y^2*x-5*y^2+8*y-4*x*y+3*x-2>=0, 3*y^2*x-8*y^2+12*y-6*x*y+4*x-3<=0], (x,0,6), (y,-2,7),plot_points=400,frame=True,axes=False)
J += text("$\chi$", (4, 1), fontsize=16, color='black')
\end{sagesilent}
$\sageplot{I+H+G}$
$\sageplot{I+J}$
\end{document}


This gave me output:

The first plot has the implicit plots drawn in, the second just has the region. I added a latex character, \chi, to the diagram to show you that you can add LaTeX text onto your figure. Changing \sageplot{I+J} to just \sageplot{I} would remove it. By modifying the code you ought to be able to get the output you want and have it look even better than Wolfram Alpha.

-
–  John Palmieri Dec 24 '11 at 19:50
Okay. I missed that one. –  DJP Dec 24 '11 at 22:57
I require Sage for this one. Unfortunately, I am on Windows and will now start wrestling the Cygwin port. Still, thanks, it looks quite versatile. +1 for now, I accept once I get it to work. –  Jesko Hüttenhain Dec 24 '11 at 23:07
Not easy to install, but worth it. Check here and here. Package documentation. Be aware that you experiment on Sage without installation via notebook site; then insert into document. –  DJP Dec 24 '11 at 23:18