Question: How to remove single points from an interval on the real line and get new interval

This is a new question came up from a follow up to https://www.mapleprimes.com/questions/225083-Maple-Command-To-Find-Domain-Of-Function

Does Maple have support for removing points from an interval automatically? An example will make this clear. This is all on the real line. No complex domain.

Given one interval,. say real_domain :=  x>-infinity and x<infinity: and now I want to remove from this interval, another interval. This second interval can be defined as single point(s) or as interval(s) itself. 

I will give an example of both.

when the singularity interval to remove is defined as one or more single points, here is an example using one point:

real_domain :=  x>-infinity and x<infinity:
singlarity_pt := 1/2:

So I want Maple to give me automatically the new interval as   {x>-infinity and x<1/2} , {x>1/2 and x<infinity}:

Becuase the singularity point was "removed" from the real domain. I tried solve, but it did not work

solve(x<>singlarity_pt and real_domain,{x})
                         

I know I could probably code this by hand, and add logic to figure it if the singularities are points. But this can get complicated if the real domain itself has many sub intervals itself. I thought Maple should be able to do this. fyi, In Mathematica, this is done as follows

singularity = 1/2;
realDomain = -Infinity < x < Infinity;
Reduce[x != singularity && realDomain , x, Reals]

Here is second example where now the singulartiy interval to remove, is not single point, but an interval itself. I found that in this case, solve did the right thing

real_domain :=  x>-infinity and x<infinity:
singlarity_domain := x>-1/2 and x<1/2:

Now the final domain should be   -infinity<x<-1/2 , 1/2<x<infinity, 

solve( not(singlarity_domain) and real_domain,{x})

The question is, why it worked when the singulaity is an interval, but it did not work when it is a specific point? And how can one make it work for single points? Is there a different command to use other than solve for this?

In general, singularities can contain single points and also intervals, but single points is more commin. So I need it to work for both cases.

This has to be done non-interactivally and without plotting or such, as it will be part of a script. 

Thanks for any hints

 

Please Wait...