Greater
Greater
a > b represents the mathematical 'greater than' relation. Use a >> b to check it in a script.
Usages
a > b or Greater[ a, b ]
a > b represents the inequality a > b, for example in a definition or an answer. In a script, it is not checked: 4 > 2 stays 4 > 2. 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 Greater[ x, 4 ] |
| Example | in | out |
|---|---|---|
| Not checked in a script. | 4 > 2 |
4 > 2 |
Checked inside Simplify. |
Simplify[ 4 > 2 ] |
True |
| Checked as a condition. | a := 5 |
r = 1 |
a >> b or GreaterEval[ a, b ]
a >> b checks directly whether the value of a is greater 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 |
|---|---|---|
4 is greater than 2. |
4 >> 2 |
True |
2 is not greater than 2. |
2 >> 2 |
False |
| Numerical values are compared. | Pi >> 3.15 |
False |
| A decimal number and a fraction. | 0.3 >> 1/3 |
False |
| Each element of a list is compared. | {1, 5, 3} >> 2 |
{False, True, True} |
| Quantities with the same unit. | Quantity[3,'m'] >> Quantity[2,'m'] |
True |
| Cannot be decided. | x >> 4 |
x >> 4 |
Details
- Different units: quantities with different units are not compared:
Quantity[3,'m'] >> Quantity[200,'cm']is left unevaluated. - Undecided conditions: a condition in
Ifthat cannot be decided is treated asTrue.
See also: GreaterEqual, Smaller, EqualsEval, If