Smaller
Smaller
a < b represents the mathematical 'smaller than' relation. Use a << b to check it in a script.
Usages
a < b or Smaller[ a, b ]
a < b represents the inequality a < b, for example in a definition or an answer. In a script, it is not checked: 2 < 4 stays 2 < 4. It is checked when it is used as a condition in If or While, or inside Simplify.
| Example | in | rendered |
|---|---|---|
The inequality x < 4. |
x < 4 or Smaller[ x, 4 ] |
| Example | in | out |
|---|---|---|
| Not checked in a script. | 2 < 4 |
2 < 4 |
Checked inside Simplify. |
Simplify[ 2 < 4 ] |
True |
| Checked as a condition. | a := 3 |
r = 1 |
a << b or SmallerEval[ a, b ]
a << b checks directly whether the value of a is smaller than the value of b, and returns True or False. If one of the values is not known, for example because it contains a variable, the comparison is left unevaluated.
| Example | in | out |
|---|---|---|
2 is smaller than 4. |
2 << 4 |
True |
2 is not smaller than 2. |
2 << 2 |
False |
| Numerical values are compared. | Pi << 3.15 |
True |
| A fraction and a decimal number. | 1/3 << 0.3 |
False |
| Each element of a list is compared. | {1, 5, 3} << 4 |
{True, False, True} |
| Quantities with the same unit. | Quantity[2,'m'] << Quantity[3,'m'] |
True |
| Cannot be decided. | x << 4 |
x << 4 |
Details
- Different units: quantities with different units are not compared:
Quantity[2,'m'] << Quantity[300,'cm']is left unevaluated. - Undecided conditions: a condition in
Ifthat cannot be decided, such asy < 4withynot defined, is treated asTrue. - Greater than: see
Greaterfora > banda >> b.
See also: SmallerEqual, Greater, EqualsEval, UnequalsEval, If