Documentation |
Indeterminates of an expression
This functionality does not run in MATLAB.
indets(object) indets(object, <All>) indets(object, <PolyExpr>) indets(object, <RatExpr>)
indets(object) returns the indeterminates contained in object.
indets(object) returns the indeterminates of object as a set, i.e., the identifiers without a value that occur in object, with the exception of those identifiers occurring in the 0th operand of a subexpression of object (see Example 1).
indets regards the special identifiers PI, EULER, CATALAN as indeterminates, although they represent constant real numbers. If you want to exclude these special identifiers, use indets(object) minus Type::ConstantIdents (see example Example 1).
If object is a polynomial, a function environment, a procedure, or a built-in kernelfunction, then indets returns the empty set. See Example 2.
Consider the following expression:
delete g, h, u, v, x, y, z: e := 1/(x[u] + g^h) - f(1/3) + (sin(y) + 1)^2*PI^3 + z^(-3)*v^(1/2)
indets(e)
Note that the returned set contains x and u and not, as one might expect, x[u], since internally x[u] is converted into the functional form _index(x, u). Moreover, the identifier f is not considered an indeterminate, since it is the 0th operand of the subexpression f(1/3).
Although PI mathematically represents a constant, it is considered an indeterminate by indets. Use Type::ConstantIdents to circumvent this:
indets(e) minus Type::ConstantIdents
The result of indets is substantially different if one of the two options RatExpr or PolyExpr is specified:
indets(e, RatExpr)
Indeed, e is a rational expression in the "indeterminates" z, PI, sin(y), g^h, x[u], v^(1/2): e is built from these atoms and the constant expression f(1/3) by using only the rational operations + , -, *, /, and ^ with integer exponents. Similarly, e is built from PI,sin(y),z^(-3),1/(g^h+x[u]),v^(1/2) and the constant expression f(1/3) using only the polynomial operations +, -, *, and ^ with nonnegative integer exponents:
indets(e, PolyExpr)
indets also works for various other data types. Polynomials and functions are considered to have no indeterminates:
delete x, y: indets(poly(x*y, [x, y])), indets(sin), indets(x -> x^2+1)
For container objects, indets returns the union of the indeterminates of all entries:
indets([x, exp(y)]), indets([x, exp(y)], PolyExpr)
For tables, only the indeterminates of the entries are returned; indeterminates in the indices are ignored:
indets(table(x = 1 + sin(y), 2 = PI))
In the previous examples we saw that the 0th operand of a subexpression is not used for finding indeterminates. With the option All this is changed:
delete x: e := sin(x): indets(e, All)
A more complex example:
delete g, h, u, v, y, z: e := 1/(x[u] + g^h) - f(1/3) + (sin(y) + 1)^2*PI^3 + z^(-3)*v^(1/2)
indets(e,All)
delete e:
All |
Identifiers occurring in the 0th operand of a subexpression of object are also included in the result. With this option, the 0th operand of a subexpression is not excluded from the search for indeterminates of object. So if the 0th operand of a subexpression is a indeterminate e.g. like sin it is included in the result, Cf. Example 3. |
PolyExpr |
Return a set of arithmetical expressions such that object is a polynomial expression in the returned expressions With this option, object is considered as a polynomial expression. Non-polynomial subexpressions, such as sin(x), x^(1/3), 1/(x+1), or f(a, b), are considered as indeterminates and are included in the returned set. However, subexpressions such as f(2, 3) are considered as constants even when the identifier f has no value. The philosophy behind this is that the expression is constant because the operands are constant (see Example 1). If object is an array, a list, a set, or a table, then indets returns a set of arithmetical expressions such that each entry of object is a polynomial expression in these expressions. See Example 2. |
RatExpr |
Return a set of arithmetical expressions such that object is a rational expression in the returned expressions With this option, object is considered as a rational expression. Similar to PolyExpr, non-rational subexpressions are considered as indeterminates (see Example 1). |
If object is an element of a library domainT that has a slot "indets", then the slot routine T::indets is called with object as argument. This can be used to extend the functionality of indets to user-defined domains. If no such slot exists, then indets returns the empty set.