On 7 Dec 2006, at 20:25, Bonny Banerjee wrote:
> I have a region specified by a logical combination of equatlities and
> inequalities. For example, r(x,y) is a region defined as follows:
>
> r(x,y) = x^2+y^2<100 or (5<=x<=25 and -10<=y<=10)
>
> How do I obtain the periphery of r(x,y)? I am only interested in
> finite
> regions i.e. x or y never extends to infinity.
>
> Thanks,
> Bonny.
>
>
I guess by the periphery you mean the boundary: the difference
between the closure and the interior of a semialgebraic set?
I think in general getting it automatically will be quite difficult.
In many simple cases you can do it using
Experimental`GenericCylindricalAlgebraicDecomposition. For example,
it works in both of your examples:
Last[Experimental`GenericCylindricalAlgebraicDecomposition[x^2 + y^2
<= 100, {x, y}]]
x^2 + y^2 - 100 == 0
and
Last[Experimental`GenericCylindricalAlgebraicDecomposition[
5 <= x <= 25 && -10 <= y <= 10, {x, y}]]
5 - x == 0 || x - 25 == 0 || -y - 10 == 0 || y - 10 == 0
Note, however, that I had to change your first example and use weak
inequalities. Unfortunately,
Experimental`GenericCylindricalAlgebraicDecomposition often will give
you too much:
Last[Experimental`GenericCylindricalAlgebraicDecomposition[
x^2 + y^2 <= 100 && x^2 + y^2 >= 4, {x, y}]]
x - 2 == 0 || x + 2 == 0 || -x^2 - y^2 + 4 == 0 || x^2 + y^2 - 100 == 0
In general in this way you will get a hypersurface containing the
boundary rather than the boundary itself.
There is also a more subtle problem involved. The boundary of an
open region is not always the boundary of the closed region that you
get by replacing strict inequalities with weak ones. For example
consider the region given by:
x^3 - x^2 - y^2 > 0 && x < 10
At first glance one might think that the boundary is given by the
part of the curve x^3 - x^2 - y^2 ==0 for which x<=10 together with
apiece of the line x==10, but actually using CylindricalDecomposition
we see that this is not the case:
CylindricalDecomposition[x^3 - x^2 - y^2 > 0 && x < 10,{x, y}]
1 < x < 10 && -Sqrt[x^3 - x^2] < y < Sqrt[x^3 - x^2]
while
CylindricalDecomposition[x^3 - x^2 - y^2 >= 0 && x <= 10, {x, y}]
(x == 0 && y == 0) || (x == 1 && y == 0) || (Inequality[1, Less, x,
LessEqual, 10] &&
-Sqrt[x^3 - x^2] <= y <= Sqrt[x^3 - x^2])
So that the point (0,0) which lies on x^3 - x^2 - y^2==0 does not
actually lie on the boundary of x^3 - x^2 -y^2>0.
Of course CylindricalDecomposition contains "the information" about
the boundary, but extracting it seems tricky, in general. Besides the
algorithm is much slower than
Experimental`GenericCylindricalAlgebraicDecomposition.
Andrzej Kozlowski
Tokyo, Japan