       Re: RegionPlot ?

• To: mathgroup at smc.vnet.net
• Subject: [mg23496] Re: [mg23489] RegionPlot ?
• From: BobHanlon at aol.com
• Date: Sun, 14 May 2000 16:59:59 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```In a message dated 5/12/2000 11:12:28 PM, SChandler at uh.edu writes:

>Right now, the function Experimental`CylindricalAlgebraicDecomposition
>yields a list of inequalities. For inequalities with two variables, I would
>like to be able to plot the region showing where that inequality is
>satisfied.
>
>By way of simple example:
>
>In:=
>ecad = Experimental`CylindricalAlgebraicDecomposition[{x + y <= 3, x -
>y
>> -4,
>       x >= 0, y >= 1}, {x, y}]
>
>Out=
>0 <= x < 2 && 1 <= y <= 3 - x || x == 2 && y == 1
>
>What I would like to do is something like:
>
>
>The output would be Polygon primitives, Line primitives,  and a Point
>primitive
>
>Any thoughts on how to implement this?
>
>Obviously, one could approximate the matter by creating a table of x,y
>values and plotting at {x,y} a primitive of some shape and size for each
>table element satisfying the set of inequalities.  I was hoping someone
>might come up with something more elegant, however. (Maybe ContourPlot
>used
>in some way?)
>

Here is an approach that makes use of FilledPlot. I haven't tested it much,
but it should give you an idea for one approach.

Needs["Graphics`FilledPlot`"]

{x_Symbol, xMin_?NumericQ, xMax_?NumericQ},
{y_Symbol, yMin_?NumericQ, yMax_?NumericQ}] :=
xmask = (UnitStep[x - First[#]] - UnitStep[x - Last[#]]) & /@
Inequality[lower___, x, upper___] -> {lower, upper}, {1,
Infinity}];
funcs =  {First[#], Last[#]} & /@
Inequality[lower___, y, upper___] -> {lower, upper}, {1,
Infinity}];
pts =
Cases[ecad, And[Equal[x, x0_], Equal[y, y0_]] ->  Point[{x0, y0}]];
plts =
FilledPlot[#1*#2, {x, xMin, xMax}, PlotRange -> {yMin, yMax},
Curves -> None,
Epilog -> {AbsolutePointSize, RGBColor[1, 0, 0], pts},
DisplayFunction -> Identity] &, {funcs, xmask}];
Show[plts, DisplayFunction -> \$DisplayFunction]
];

ecad = Experimental`CylindricalAlgebraicDecomposition[{x + y <= 3, x - y > -4,
x >= 0, y >= 1}, {x, y}]

regionPlot[ecad, {x, -3, 5}, {y, -3, 7}];

ecad = Experimental`CylindricalAlgebraicDecomposition[{x + y <= 6, x - y > -4,
x >= 0, y >= -2}, {x, y}]

regionPlot[ecad, {x, -3, 10}, {y, -3, 6}];

Bob

BobHanlon at aol.com

```

• Prev by Date: Re: approximation by rationals
• Next by Date: Re: plot discrete spectrum
• Previous by thread: RegionPlot ?
• Next by thread: degree symbol "bug"