0
$\begingroup$

This function has two separate branches (not connected together):

func = ConditionalExpression[1/(1 - 2 x)^2, 0 < x < 1];

enter image description here

Given a range of x, for example:

range = {0.2, 0.3};

how can I extract the branch of func that this range belongs to (all points of the range should be belong to the branch)?

For instance, with the range above, the expected output would be:

ConditionalExpression[1/(1 - 2 x)^2, 0 < x < 1/2]

I’m looking for a robust method. One idea I had was:

FunctionDomain[ConditionalExpression[1/(1 - 2 x)^2, 0 < x < 1], x]
(* 0 < x < 1/2 || 1/2 < x < 1 *)

and then separate the branches using ||, but I’m not sure if that’s reliable.

$\endgroup$

2 Answers 2

2
$\begingroup$
func = ConditionalExpression[1/(1 - 2 x)^2, 0 < x < 1];

func2 = ConditionalExpression[func[[1]], #] & /@ (List @@ 
    FunctionDomain[func, x])

enter image description here

range = {0.2, 0.3};

Select[func2, 
 IntervalMemberQ[Interval[(List @@ #[[2]])[[{1, -1}]]], 
   Interval[range]] &]

enter image description here

$\endgroup$
2
$\begingroup$

We use RegionWithin to select the region which contained within the interval Interval[{0.2,0.3}].

Clear[regs, reg, result];
func = ConditionalExpression[1/(1 - 2 x)^2, 0 < x < 1];
range = {0.2, 0.3};
regs = ImplicitRegion[#, {x}] & /@ 
   Level[FunctionDomain[func, {x}], {1}];
reg = Interval[range];
result = Select[regs, RegionWithin[#, reg] &][[1, 1]]
ConditionalExpression[func[[1]], result]

enter image description here

$\endgroup$
1
  • $\begingroup$ Would it be possible to make it work with function contain only one branch as well, for example func = ConditionalExpression[x, 0 < x < 1]? $\endgroup$ Commented Oct 29 at 7:18

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.