-1
$\begingroup$

How can we put the range of a variable in splited form for a variable?

i.e. p belong to (0, 0.2) && (0.6, 1)

i.e. p belongs to (0, 0.2) and also belongs to (0.6, 1).

Thanking you.

$\endgroup$
  • 1
    $\begingroup$ Lookup Or, is this what you want? $\endgroup$ – Kuba Nov 20 '17 at 14:35
  • $\begingroup$ I again clear my doubt, Sir. Please see again. $\endgroup$ – Dauood Saleem Nov 20 '17 at 14:50
  • 1
    $\begingroup$ Please provide context, plotting, solving, statistics? $\endgroup$ – Kuba Nov 20 '17 at 16:11
1
$\begingroup$

This should help you determine if a value belongs in an interval range or group of ranges:

f[x_] := IntervalMemberQ[Interval[{0.0, 0.2}, {0.6, 1}], x]
$\endgroup$
0
$\begingroup$
fpt[x_] := 
 If[x > 0 && x < 0.2, 0.3 - x,  
  If[x > 0.6 && x < 1, x - 0.5, Nothing]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.