I want to plot the solution of two inequalities and include them in a LaTeX paper. I really like they way this looks: Wolfram Alpha. Unfortunately, I have no idea how to export this into a LaTeX-suitable format and I don't have a version of Mathematica.

I have tried it with the implicitplot command of Maple but it does not look good at all. It displays the solutions of each of the inequalities but not both. Any ideas?

  • 3
    It is possible to do this without using Mathematica or Maple. That is, you can do this from within LaTeX. Are the inequalities in your link the ones you want plotted? – Werner Dec 9 '11 at 23:25
  • 1
    While Werners suggestion is better, and I'd recommend pursuing that, you can save a PDF from WolframAlpha (link towards the bottom) that will have a vectorized version of the plot. It's not a good solution though, as you have to crop the PDF somehow. – Torbjørn T. Dec 10 '11 at 2:28

I would recommend that you plot these outside of Wolfram Alpha and just use LaTeX. Here is a pgfplots version that should get you started:

enter image description here


        thick,smooth,no markers,samples=100,
        xlabel=$x$, ylabel=$y$
            \addplot [domain=-1:0,fill=blue!20] {-sqrt(1-(x)^2)};
            \addplot [domain=-1:0]              {-x-1};
|improve this answer|||||
  • If you interchange the \addplots, both border lines will have equal "thickness". – Gonzalo Medina Dec 10 '11 at 2:35
  • @GonzaloMedina: Thanks, Have corrected the solution. I did notice that and was trying to figure how to correct it. Do you know why the order mattered in this case? – Peter Grill Dec 10 '11 at 2:38
  • 2
    As you had it, the straight line was drawn first and then the circular sector covered "half of it". Reversing the order, the sector is drawn first and then the line is not overwritten. Sorry I couldn't find a better way to say these in English; hope it makes sense ;-) – Gonzalo Medina Dec 10 '11 at 2:42

Here's an option using PSTricks






I hope I don't get flamed for doing this, but here's some Maple code that does the same thing

f:=x->-sqrt(1-x^2):     # define f(x)
g:=x->-x-1:         # define g(x)
a:=-1:  b:=0:       # interval [a,b]

# plotting window
xmin:=-2:   xmax:=2:    ymin:=-1:   ymax:=4:

# define the points for f(x) and g(x)
fpoints := [seq([a+(b-a)/N*i,f(a+(b-a)/N*i) ],i=0..N)]:
gpoints := Reverse([seq([a+(b-a)/N*i,g(a+(b-a)/N*i) ],i=0..N)]):

# plot them!
            view = [xmin..xmax,ymin..ymax]):
|improve this answer|||||

You mentioned having difficulty using Maple's implicitplot for this. You might well wish to use just latex packages such as pstricks or pgfplots, but here is a Maple code solution (tried in versions 13 and 15) since you mention that in both your post's title and body.

plots:-implicitplot( (x,y)->(y-(-sqrt(1-x^2)))*(y-(-x-1)),
                 -1..0,-1..0, view=[-1.5..1.5,-1.5..1.5],
                 gridrefine=3, filledregions=true, axes=boxed,
                 labels=["x","y"] );

enter image description here

I zoomed in before exporting that image, which is why the axis labels look to small. If i hadn't panned in before exporting, those labels would be sized ok. (Sorry, first image insertion here.)

This post was imported from stackoverflow, where it had the maple tag, yes? Did that tag get lost, on import here? It may pr may not be the optimal solution, but the tag seems sensible as that software is mentioned in both title and text body.

|improve this answer|||||
  • Another way (which might possibly produce smoother curves) is to overlay a pair of filled implicit plots. The first colors in blue from first curve down to x-axis, while the second colors in white from second curve down to x-axis. with(plots): display( implicitplot( y<=-sqrt(1-x^2), x=-1..0, y=-1..0, filledregions=true, gridrefine=2, coloring=["white","white"] ), implicitplot( y<=-x-1, x=-1..0, y=-1..0, filledregions=true, coloring=[COLOUR(RGB,.8,.8,.9),"white"] ), axes=boxed, labels=["x","y"], view=-1.5..1.5,-1.5..1.5]); – acer Dec 12 '11 at 10:31

The sagetex package is another option. Then you use Sage, which is free, instead of Mathematica or Maple.


 var('x, y')
 P = region_plot([x+y+1<0,x^2+y^2-1<0], (x, -1, 1), (y, -1, 1), plot_points=300)




|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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