< , > , <= , >= , != , = , Not , And , Or , IsFreeOf , IsZeroVector , IsNonObject , IsEven , IsOdd , IsFunction , IsAtom , IsString , IsNumber , IsList , IsBound , IsBoolean , IsNegativeNumber , IsNegativeInteger , IsPositiveNumber , IsPositiveInteger , IsNotZero , IsNonZeroInteger , IsInfinity , IsPositiveReal , IsNegativeReal , IsConstant .

# Predicates

A predicate is a function that returns a boolean value, i.e. `True` or `False`. Predicates are often used in patterns, For instance, a rule that only holds for a positive integer would use a pattern like `n_IsPositiveInteger`.

< | Test whether lhs is smaller than rhs
> | Test whether lhs is larger than rhs
<= | Test whether lhs is smaller or equal rhs
>= | Test whether lhs is larger or equal rhs
!= | Test whether two expressions are not equal
= | Test whether two expressoins are equal
Not | Logical negation
And | Logical conjunction
Or | Logical disjunction
IsFreeOf | Test whether expression depends on variable
IsZeroVector | Test whether list contains only zeroes
IsNonObject | Test whether argument is not an Object()
IsEven | Test whether integer is even
IsOdd | Test whether integer is odd
IsFunction | Test whether argument is a composite object
IsAtom | Test whether argument is an atom
IsString | Test whether argument is an string
IsNumber | Test whether argument is a number
IsList | Test whether argument is a list
IsBound | Test whether a variable is bound to a value
IsBoolean | Test whether argument is a Boolean
IsNegativeNumber | Test whether argument is a negative number
IsNegativeInteger | Test whether argument is a negative integer
IsPositiveNumber | Test whether argument is a positive number
IsPositiveInteger | Test whether argument is a positive integer
IsNotZero | Test whether argument is a nonzero number
IsNonZeroInteger | Test whether argument is a nonzero integer
IsInfinity | Test whether argument is an infinity
IsPositiveReal | Test whether argument is numerically positive
IsNegativeReal | Test whether argument is numerically negative
IsConstant | Test whether argument is constant

###

< -- Test whether lhs is smaller than rhs

Standard math library

##### Calling Sequence:

e1 < e2 (prec. 9)

##### Parameters:

e1, e2 - expressions to be compared

##### Description:

The two expression are evaluated. If both results are numeric, they are compared. If the first expression is smaller than the second one, the result is `True` and it is `False` otherwise. If either of the expression is not numeric, after evaluation, the expression is returned with evaluated arguments.

The word "numeric" in the previous paragraph has the following meaning. An expression is numeric if it is either a number (i.e. `IsNumber` returns `True`), or the quotient of two numbers, or an infinity (i.e. `IsInfinity` returns `True`).

##### Examples:

    In> 2 < 5;
    Out> True;
    In> Cos(1) < 5;
    Out> Cos(1)<5;
    In> N(Cos(1)) < 5;
    Out> True

##### See Also:

IsNumber , IsInfinity , N .

###

> -- Test whether lhs is larger than rhs

Standard math library

##### Calling Sequence:

e1 > e2 (prec. 9)

##### Parameters:

e1, e2 - expressions to be compared

##### Description:

The two expression are evaluated. If both results are numeric, they are compared. If the first expression is larger than the second one, the result is `True` and it is `False` otherwise. If either of the expression is not numeric, after evaluation, the expression is returned with evaluated arguments.

The word "numeric" in the previous paragraph has the following meaning. An expression is numeric if it is either a number (i.e. `IsNumber` returns `True`), or the quotient of two numbers, or an infinity (i.e. `IsInfinity` returns `True`).

##### Examples:

    In> 2 > 5;
    Out> False;
    In> Cos(1) > 5;
    Out> Cos(1)>5;
    In> N(Cos(1)) > 5;
    Out> False

##### See Also:

IsNumber , IsInfinity , N .

###

<= -- Test whether lhs is smaller or equal rhs

Standard math library

##### Calling Sequence:

e1 <= e2 (prec. 9)

##### Parameters:

e1, e2 - expressions to be compared

##### Description:

The two expression are evaluated. If both results are numeric, they are compared. If the first expression is smaller than or equals the second one, the result is `True` and it is `False` otherwise. If either of the expression is not numeric, after evaluation, the expression is returned with evaluated arguments.

The word "numeric" in the previous paragraph has the following meaning. An expression is numeric if it is either a number (i.e. `IsNumber` returns `True`), or the quotient of two numbers, or an infinity (i.e. `IsInfinity` returns `True`).

##### Examples:

    In> 2 <= 5;
    Out> True;
    In> Cos(1) <= 5;
    Out> Cos(1)<=5;
    In> N(Cos(1)) <= 5;
    Out> True

##### See Also:

IsNumber , IsInfinity , N .

###

>= -- Test whether lhs is larger or equal rhs

Standard math library

##### Calling Sequence:

e1 >= e2 (prec. 9)

##### Parameters:

e1, e2 - expressions to be compared

##### Description:

The two expression are evaluated. If both results are numeric, they are compared. If the first expression is larger than or equals the second one, the result is `True` and it is `False` otherwise. If either of the expression is not numeric, after evaluation, the expression is returned with evaluated arguments.

The word "numeric" in the previous paragraph has the following meaning. An expression is numeric if it is either a number (i.e. `IsNumber` returns `True`), or the quotient of two numbers, or an infinity (i.e. `IsInfinity` returns `True`).

##### Examples:

    In> 2 >= 5;
    Out> False;
    In> Cos(1) >= 5;
    Out> Cos(1)>=5;
    In> N(Cos(1)) >= 5;
    Out> False

##### See Also:

IsNumber , IsInfinity , N .

###

!= -- Test whether two expressions are not equal

Standard math library

##### Calling Sequence:

e1 != e2 (prec. 9)

##### Parameters:

e1, e2 - expressions to be compared

##### Description:

Both expression are evaluated and compared. If they turn out to be equal, the result is `False`. Otherwise, the result is `True`.

The expression `e1 != e2` is equivalent to `Not(e1 = e2)`.

##### Examples:

    In> 1 != 2;
    Out> True;
    In> 1 != 1;
    Out> False;

##### See Also:

= .

###

= -- Test whether two expressoins are equal

Standard math library

##### Calling Sequence:

e1 = e2 (prec. 9)

##### Parameters:

e1, e2 - expressions to be compared

##### Description:

Both expression are evaluated and compared. If they turn out to be equal, the result is `True`. Otherwise, the result is `False`. The function `Equals` does the same.

Note that the test is on syntactic equality, not mathematical equality. Hence even if the result is `False`, the expressions can still be (mathematically) equal; see the examples underneath. Put otherwise, this function tests whether the two expressions would be displayed in the same way if they were printed.

##### Examples:

    In> e1 := (x+1) * (x-1);
    Out> (x+1)*(x-1);
    In> e2 := x^2 - 1;
    Out> x^2-1;

    In> e1 = e2;
    Out> False;
    In> Expand(e1) = e2;
    Out> True;

!= , Equals .

###

Not -- Logical negation

Internal function

##### Calling Sequence:

Not bool

##### Parameters:

bool - a boolean expression

##### Description:

Not returns the logical negation of the argument bool. If bool is False it returns True, and if the argument is True Not returns False. If the argument is neither True nor False it returns the entire expression with evaluated arguments.

##### Examples:

    In> Not True
    Out> False;
    In> Not False
    Out> True;
    In> Not(a)
    Out> Not a;

##### See Also:

And , Or .

###

And -- Logical conjunction

Internal function

##### Calling Sequence:

a1 And a2 (prec. 100)
And(a1,a2,a3,...,an)

##### Parameters:

a1 .. an - boolean values (True or False)

##### Description:

This function returns True if all arguments are true. The And operation is lazy, it returns False as soon as a False argument is found (from left to right). If an argument other than True or False is encountered a new And expression is returned with all arguments that didn't evaluate to True or False yet.

##### Examples:

    In> True And False
    Out> False;
    In> And(True,True)
    Out> True;
    In> False And a
    Out> False;
    In> True And a
    Out> And(a);
    In> And(True,a,True,b)
    Out> b And a;

##### See Also:

Or , Not .

###

Or -- Logical disjunction

Internal function

##### Calling Sequence:

a1 Or a2 (prec. 101)
Or(a1,a2,a3,...,an)

##### Parameters:

a1 .. an - boolean values (True or False)

##### Description:

This function returns True if an argument is encountered that is true (scanning from left to right). The Or operation is lazy, it returns True as soon as a True argument is found (from left to right). If an argument other than True or False is encountered a new Or expression is returned with all arguments that didn't evaluate to True or False yet.

##### Examples:

    In> True Or False
    Out> True;
    In> False Or a
    Out> Or(a);
    In> Or(False,a,b,True)
    Out> True;

##### See Also:

And , Not .

###

IsFreeOf -- Test whether expression depends on variable

Standard math library

##### Calling Sequence:

IsFreeOf(expr, var)
IsFreeOf(expr, {var, ...})

##### Parameters:

expr - expression to test
var - variable to look for in "expr"

##### Description:

This function checks whether the expression "expr" (after being evaluated) depends on the variable "var". It returns `False` if this is the case and `True` otherwise.

The second form test whether the expression depends on any of the variables named in the list. The result is `True` if none of the variables appear in the expression and `False` otherwise.

##### Examples:

    In> IsFreeOf(Sin(x), x);
    Out> False;
    In> IsFreeOf(Sin(x), y);
    Out> True;
    In> IsFreeOf(D(x) a*x+b, x);
    Out> True;
    In> IsFreeOf(Sin(x), {x,y});
    Out> False;

The third command returns `True` because the expression `D(x) a*x+b` evaluates to `a`, which does not depend on `x`.

##### See Also:

Contains .

###

IsZeroVector -- Test whether list contains only zeroes

Standard math library

##### Calling Sequence:

IsZeroVector(list)

##### Parameters:

list - list to compare against the zero vector

##### Description:

The only argument given to `IsZeroVector` should be a list. The result is `True` if the list contains only zeroes and `False` otherwise.

##### Examples:

    In> IsZeroVector({0, x, 0});
    Out> False;
    In> IsZeroVector({x-x, 1 - D(x) x});
    Out> True;

##### See Also:

IsList , ZeroVector .

###

IsNonObject -- Test whether argument is not an Object()

Standard math library

##### Calling Sequence:

IsNonObject(expr)

##### Parameters:

expr - the expression to examine

##### Description:

This function returns `True` if "expr" is not of the form `Object(...)` and `False` otherwise.

##### Bugs:

In fact, the result is always `True`.

##### See Also:

Object .

###

IsEven -- Test whether integer is even

Standard math library

##### Calling Sequence:

IsEven(n)

##### Parameters:

n - integer to test

##### Description:

This function tests whether the integer "n" is even. An integer is even if it is divisible by two. Hence the even numbers are 0, 2, 4, 6, 8, 10, etcetera, and -2, -4, -6, -8, -10, etcetera.

##### Examples:

    In> IsEven(4);
    Out> True;
    In> IsEven(-1);
    Out> False;

##### See Also:

IsOdd , IsInteger .

###

IsOdd -- Test whether integer is odd

Standard math library

##### Calling Sequence:

IsOdd(n)

##### Parameters:

n - integer to test

##### Description:

This function tests whether the integer "n" is odd. An integer is odd if it is not divisible by two. Hence the odd numbers are 1, 3, 5, 7, 9, etcetera, and -1, -3, -5, -7, -9, etcetera.

##### Examples:

    In> IsOdd(4);
    Out> False;
    In> IsOdd(-1);
    Out> True;

##### See Also:

IsEven , IsInteger .

###

IsFunction -- Test whether argument is a composite object

Internal function

##### Calling Sequence:

IsFunction(expr)

##### Parameters:

expr - expression to test

##### Description:

This function tests whether "expr" is a composite object, ie. not an atom. This includes not only obvious functions like `f(x)`, but also expressions like `x+5` and lists.

##### Examples:

    In> IsFunction(x+5);
    Out> True;
    In> IsFunction(x);
    Out> False;

##### See Also:

IsAtom , IsList , Type .

###

IsAtom -- Test whether argument is an atom

Internal function

##### Calling Sequence:

IsAtom(expr)

##### Parameters:

expr - expression to test

##### Description:

This function tests whether "expr" is an atom. Numbers, strings, and variables are all atoms.

##### Examples:

    In> IsAtom(x+5);
    Out> Falso;
    In> IsAtom(5);
    Out> True;

##### See Also:

IsFunction , IsNumber , IsString .

###

IsString -- Test whether argument is an string

Internal function

##### Calling Sequence:

IsString(expr)

##### Parameters:

expr - expression to test

##### Description:

This function tests whether "expr" is a string. A string is a text within quotes, eg. `"duh"`.

##### Examples:

    In> IsString("duh");
    Out> True;
    In> IsString(duh);
    Out> False;

##### See Also:

IsAtom , IsNumber .

###

IsNumber -- Test whether argument is a number

Internal function

##### Calling Sequence:

IsNumber(expr)

##### Parameters:

expr - expression to test

##### Description:

This function tests whether "expr" is a number. There are two kinds of numbers, integers (like 6) and reals (like -2.75 or 6.0). Note that a complex number is represented by the `Complex` function, so `IsNumber` will return `False`.

##### Examples:

    In> IsNumber(6);
    Out> True;
    In> IsNumber(3.25);
    Out> True;
    In> IsNumber(I);
    Out> False;
    In> IsNumber("duh");
    Out> False;

##### See Also:

IsAtom , IsString , IsInteger , IsPositiveNumber , IsNegativeNumber , Complex .

###

IsList -- Test whether argument is a list

Internal function

##### Calling Sequence:

IsList(expr)

##### Parameters:

expr - expression to test

##### Description:

This function tests whether "expr" is a list. A list is a sequence between curly braces, like `{2, 3, 5}`.

##### Examples:

    In> IsList({2,3,5});
    Out> True;
    In> IsList(2+3+5);
    Out> False;

##### See Also:

IsFunction .

###

IsBound -- Test whether a variable is bound to a value

Internal function

##### Calling Sequence:

IsBound(var)

##### Parameters:

var - variable to test

##### Description:

This function tests whether the variable "var" is bound, ie. whether it has a value. The argument "var" is not evaluated.

##### Examples:

    In> IsBound(x);
    Out> False;
    In> x := 5;
    Out> 5;
    In> IsBound(x);
    Out> True;

##### See Also:

IsAtom .

###

IsBoolean -- Test whether argument is a Boolean

Standard math library

##### Calling Sequence:

IsBoolean(expression)

##### Parameters:

expression - an expression

##### Description:

IsBoolean returns True if the argument is of a boolean type. This means it has to be either True, False, or an expression involving functions that return a boolean result, like =, >, <, >=, <=, !=, And, Not, Or.

##### Examples:

    In> IsBoolean(a)
    Out> False;
    In> IsBoolean(True)
    Out> True;
    In> IsBoolean(a And b)
    Out> True;

##### See Also:

True , False .

###

IsNegativeNumber -- Test whether argument is a negative number

Standard math library

##### Calling Sequence:

IsNegativeNumber(n)

##### Parameters:

n - number to test

##### Description:

`IsNegativeNumber(n)` evaluates to `True` if "n" is (strictly) negative, ie. if n<0. If "n" is not a number, the function returns `False`.

##### Examples:

    In> IsNegativeNumber(6);
    Out> False;
    In> IsNegativeNumber(-2.5);
    Out> True;

##### See Also:

IsNumber , IsPositiveNumber , IsNotZero , IsNegativeInteger , IsNegativeReal .

###

IsNegativeInteger -- Test whether argument is a negative integer

Standard math library

##### Calling Sequence:

IsNegativeInteger(n)

##### Parameters:

n - integer to test

##### Description:

This function tests whether the integer "n" is (strictly) negative. The negative integers are -1, -2, -3, -4, -5, etcetera. If "n" is not a integer, the function returns `False`.

##### Examples:

    In> IsNegativeInteger(31);
    Out> False;
    In> IsNegativeInteger(-2);
    Out> True;

##### See Also:

IsPositiveInteger , IsNonZeroInteger , IsNegativeNumber .

###

IsPositiveNumber -- Test whether argument is a positive number

Standard math library

##### Calling Sequence:

IsPositiveNumber(n)

##### Parameters:

n - number to test

##### Description:

`IsPositiveNumber(n)` evaluates to `True` if "n" is (strictly) positive, ie. if n>0. If "n" is not a number the function returns `False`.

##### Examples:

    In> IsPositiveNumber(6);
    Out> True;
    In> IsPositiveNumber(-2.5);
    Out> False;

##### See Also:

IsNumber , IsNegativeNumber , IsNotZero , IsPositiveInteger , IsPositiveReal .

###

IsPositiveInteger -- Test whether argument is a positive integer

Standard math library

##### Calling Sequence:

IsPositiveInteger(n)

##### Parameters:

n - integer to test

##### Description:

This function tests whether the integer "n" is (strictly) positive. The positive integers are 1, 2, 3, 4, 5, etcetera. If "n" is not a integer the function returns `False`.

##### Examples:

    In> IsPositiveInteger(31);
    Out> True;
    In> IsPositiveInteger(-2);
    Out> False;

##### See Also:

IsNegativeInteger , IsNonZeroInteger , IsPositiveNumber .

###

IsNotZero -- Test whether argument is a nonzero number

Standard math library

##### Calling Sequence:

IsNotZero(n)

##### Parameters:

n - number to test

##### Description:

`IsNotZero(n)` evaluates to `True` if "n" is not zero. In case "n" is not a number, the function returns `False`.

##### Examples:

    In> IsNotZero(3.25);
    Out> True;
    In> IsNotZero(0);
    Out> False;

##### See Also:

IsNumber , IsPositiveNumber , IsNegativeNumber , IsNonZeroInteger .

###

IsNonZeroInteger -- Test whether argument is a nonzero integer

Standard math library

##### Calling Sequence:

IsNonZeroInteger(n)

##### Parameters:

n - integer to test

##### Description:

This function tests whether the integer "n" is not zero. If "n" is not an integer, the result is `False`.

##### Examples:

    In> IsNonZeroInteger(0)
    Out> False;
    In> IsNonZeroInteger(-2)
    Out> True;

##### See Also:

IsPositiveInteger , IsNegativeInteger , IsNotZero .

###

IsInfinity -- Test whether argument is an infinity

Standard math library

##### Calling Sequence:

IsInfinity(expr)

##### Parameters:

expr - expression to test

##### Description:

This function tests whether "expr" is an infinity. This is only the case if "expr" is either `Infinity` or `-Infinity`.

##### Examples:

    In> IsInfinity(10^1000);
    Out> False;
    In> IsInfinity(-Infinity);
    Out> True;

##### See Also:

Integer .

###

IsPositiveReal -- Test whether argument is numerically positive

Standard math library

##### Calling Sequence:

IsPositiveReal(expr)

##### Parameters:

expr - expression to test

##### Description:

This function tries to approximate "expr" numerically. It returns `True` if this approximation is positive. In case no approximation can be found, the function returns `False`. Note that round-off errors may cause incorrect results.

##### Examples:

    In> IsPositiveReal(Sin(1)-3/4);
    Out> True;
    In> IsPositiveReal(Sin(1)-6/7);
    Out> False;
    In> IsPositiveReal(Exp(x));
    Out> False;

The last result is because `Exp(x)` cannot be numerically approximated if `x` is not known. Hence Yacas can not determine the sign of this expression.

##### See Also:

IsNegativeReal , IsPositiveNumber , N .

###

IsNegativeReal -- Test whether argument is numerically negative

Standard math library

##### Calling Sequence:

IsNegativeReal(expr)

##### Parameters:

expr - expression to test

##### Description:

This function tries to approximate "expr" numerically. It returns `True` if this approximation is negative. In case no approximation can be found, the function returns `False`. Note that round-off errors may cause incorrect results.

##### Examples:

    In> IsNegativeReal(Sin(1)-3/4);
    Out> False;
    In> IsNegativeReal(Sin(1)-6/7);
    Out> True;
    In> IsNegativeReal(Exp(x));
    Out> False;

The last result is because `Exp(x)` cannot be numerically approximated if `x` is not known. Hence Yacas can not determine the sign of this expression.

##### See Also:

IsPositiveReal , IsNegativeNumber , N .

###

IsConstant -- Test whether argument is constant

Standard math library

##### Calling Sequence:

IsConstant(expr)

##### Parameters:

expr - some expression

##### Description:

`IsConstant` returns `True` if the expression is some constant or a function with constant arguments. It does this by checking that no variables are referenced in the expression.

##### Examples:

    In> IsConstant(Cos(x))
    Out> False;
    In> IsConstant(Cos(2))
    Out> True;
    In> IsConstant(Cos(2+x))
    Out> False;

##### See Also:

IsNumber , IsInteger , VarList .