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.
1 Answers
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.
-
-
-
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
edityour 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