# Question:SemiAlgebraicSetTools:-IsEmpty vs SemiAlgebraic?

## Question:SemiAlgebraicSetTools:-IsEmpty vs SemiAlgebraic?

Maple

According to the Maple documentation, both commands can handle inequalities. I'm only interested in checking when a semialgebraic set is empty, so I thought SemiAlgebraicSetTools:-IsEmpty would be generally faster than computing the solutions with the SemiAlgebraic command. However, the following code shows otherwise:

Code 1:

```

restart;
with(SolveTools, SemiAlgebraic);

B_poly := -(x + 4)*(x + 3)*(x + 2)*(x + 1)*(x - 1)*(x - 2)*(x - 3)*(x - 4);
g := -1/100000*(x+4)*(x+3)*(x+2)*(x+1)*(x-1)*(x-2)*(x-3)*(x-4)*(-1/670*(x+4)
*(x+3)*(x+2)*(x+1)*(x-1)*(x-2)*(x-3)*(x-4)-669/670)^136+1/100000*(x+4)*(x+3)*(x
+2)*(x+1)*(x-1)*(x-2)*(x-3)*(x-4)*(1/670*(x+4)*(x+3)*(x+2)*(x+1)*(x-1)*(x-2)*(x
-3)*(x-4)-669/670)^136;
f := -4347225/87808*x^8 - 17375/392*x^7 + 629491375/395136*x^6 +
266375/252*x^5 - 200677775/12544*x^4 - 3174625/504*x^3 +
11067842125/197568*x^2 - 53625/98*x - 126496075/4116;

SemiAlgebraic(
[B_poly >= 0, g - f >= 0], [x]);

```

Code 2:

```

restart;
with(RegularChains, SemiAlgebraicSetTools, PolynomialRing);

local R := PolynomialRing([x]);

B_poly := -(x + 4)*(x + 3)*(x + 2)*(x + 1)*(x - 1)*(x - 2)*(x - 3)*(x - 4);
g := -1/100000*(x+4)*(x+3)*(x+2)*(x+1)*(x-1)*(x-2)*(x-3)*(x-4)*(-1/670*(x+4)
*(x+3)*(x+2)*(x+1)*(x-1)*(x-2)*(x-3)*(x-4)-669/670)^136+1/100000*(x+4)*(x+3)*(x
+2)*(x+1)*(x-1)*(x-2)*(x-3)*(x-4)*(1/670*(x+4)*(x+3)*(x+2)*(x+1)*(x-1)*(x-2)*(x
-3)*(x-4)-669/670)^136;
f := -4347225/87808*x^8 - 17375/392*x^7 + 629491375/395136*x^6 +
266375/252*x^5 - 200677775/12544*x^4 - 3174625/504*x^3 +
11067842125/197568*x^2 - 53625/98*x - 126496075/4116;

SemiAlgebraicSetTools:-IsEmpty([B_poly >= 0, g-f >= 0], R);

```

My computer finishes 'Code 1' in about 20 seconds, while 'Code 2' doesn't terminate. Am I misunderstanding something about how to use these commands for my problem? I'd appreciate it if you could clarify why this is happening and when to use each command in each case. Thanks!

﻿