# Using 0 < x < 10 as a condition in an equation

How do I write 0 < x < 10 on the right side in the equation. If #1 + #2 is bigger than 0 and smaller than 10. And is it possible to require -10 < x < 10 with the additional condition x != 0

If[#1 + #2 == ??, ... ]

• It's not really clear what you want here. If you're testing the summed slots then you can just say 0<#1+#2<10 and it'll return True/False if the sum is in/out of that range. – IPoiler Dec 1 '15 at 18:46
• The syntax for Less[ ] is Less[1, 2, 3, ...] or the shorthand 1 < 2 < 3 Try them out – Dr. belisarius Dec 1 '15 at 18:50
• I am using this If[Last[#3 - #2] == 0 && First[#2 - #1] == 1, "01 X" <> ToString@First@#2 <> " Y" <> ToString@Last@#2, Unevaluated@ Sequence[ "00 X" <> ToString@First@#2 <> " Y" <> ToString@Last@#2, "01 X" <> ToString@First@#2 <> " Y" <> ToString@Last@#2] ] & and would like to get 0 < X <10 instead of 0 but i can't seem to make it work. EDIT: just saw your last comment, going to try it. – EminemIsLife Dec 1 '15 at 18:51
• I have tried the following and something similar: Example: list = {{1, 2}, {1, 2}} Last[#1 + #2] == [Less && Greater] & , not sure if I should use == at all, i dont know what to do. – EminemIsLife Dec 1 '15 at 19:06
• try to add a clear explanation of what you are actually trying to accomplish (edit the question, not in comment) – george2079 Dec 1 '15 at 19:28

You can put more conditions in with the "and" operator "&&", e.g.:

Plot[If[x < 1 && x > 0, 2, -2], {x, -2, 2}] And you second example would be

If[{-10 < x < 10 && x != 0}, 1, 2]


You can work with ConditionalExpression or Condition or Piecewise

f[x_] := x^2 /; 0 < x < 10
Plot[f[x], {x, -10, 10}] h[x_] := 3 x/Sin[x] /; -10 < x < 10 && x != 0
Plot[h[x], {x, -20, 20}] g[x_] := Piecewise[{{-x^2, 0 < x < 10}, {2 x, -10 < x < 10 && x != 0}}]
Plot[g[x], {x, -20, 20}, Frame -> True] And with Assumptions

FunctionExpand[x^2/Sin[x], Assumptions -> 0 < x < 10]


x^2 Csc[x]

Plot[x^2 Csc[x], {x, -37.6991, 37.6991}] 