<
,
>
,
<=
,
>=
,
!=
,
=
,
Not
,
And
,
Or
,
IsFreeOf
,
IsZeroVector
,
IsNonObject
,
IsEven
,
IsOdd
,
IsFunction
,
IsAtom
,
IsString
,
IsNumber
,
IsList
,
IsNumericList
,
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 for "less than"
Standard math library
Calling format:
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 for "greater than"
Standard math library
Calling format:
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 for "less or equal"
Standard math library
Calling format:
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 for "greater or equal"
Standard math library
Calling format:
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 for "not equal"
Standard math library
Calling format:
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 for equality of expressions
Standard math library
Calling format:
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 below. 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;
|
See also:
!=
,
Equals
.
Not -- Logical negation
Internal function
Calling format:
Parameters:
expr -- a boolean expression
Description:
Not returns the logical negation of the argument expr. If expr is
False it returns True, and if expr is True, Not expr 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 format:
a1 And a2 (prec. 100)
And(a1, a2, a3, ..., aN)
|
Parameters:
a1, ..., aN - boolean values (may evaluate to 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 format:
a1 Or a2 (prec. 101)
Or(a1, a2, a3, ..., aN)
|
Parameters:
a1, ..., aN - boolean expressions (may evaluate to 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, an unevaluated 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 format:
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 format:
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 format:
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 for an even integer
Standard math library
Calling format:
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 for an odd integer
Standard math library
Calling format:
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 for a composite object
Internal function
Calling format:
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 for an atom
Internal function
Calling format:
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 for an string
Internal function
Calling format:
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 for a number
Internal function
Calling format:
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 for a list
Internal function
Calling format:
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
.
IsNumericList -- test for a list of numbers
Standard math library
Calling format:
Parameters:
{list} -- a list
Description:
Returns True when called on a list of numbers or expressions that evaluate to numbers using N(). Returns False otherwise.
See also:
N
,
IsNumber
.
IsBound -- test for a bound variable
Internal function
Calling format:
Parameters:
var - variable to test
Description:
This function tests whether the variable "var" is bound, ie. whether
it has been assigned 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 for a Boolean value
Standard math library
Calling format:
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 for a negative number
Standard math library
Calling format:
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 for a negative integer
Standard math library
Calling format:
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 for a positive number
Standard math library
Calling format:
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 for a positive integer
Standard math library
Calling format:
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 for a nonzero number
Standard math library
Calling format:
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 for a nonzero integer
Standard math library
Calling format:
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 for an infinity
Standard math library
Calling format:
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 for a numerically positive value
Standard math library
Calling format:
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 for a numerically negative value
Standard math library
Calling format:
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 for a constant
Standard math library
Calling format:
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
.