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 == ??, ... ]
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityHow 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 == ??, ... ]
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}]
0<#1+#2<10
and it'll returnTrue
/False
if the sum is in/out of that range. $\endgroup$ – IPoiler Dec 1 '15 at 18:46Less[ ]
isLess[1, 2, 3, ...]
or the shorthand1 < 2 < 3
Try them out $\endgroup$ – Dr. belisarius Dec 1 '15 at 18:50If[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. $\endgroup$ – EminemIsLife Dec 1 '15 at 18:51list = {{1, 2}, {1, 2}}
Last[#1 + #2] == [Less[5] && Greater[3]] &
, not sure if I should use == at all, i dont know what to do. $\endgroup$ – EminemIsLife Dec 1 '15 at 19:06