indets
-- the indeterminates of
an expressionindets(
object)
returns the indeterminates
contained in object
.
indets(object)
indets(object, PolyExpr)
indets(object, RatExpr)
object |
- | an arbitrary object |
PolyExpr |
- | return a set of arithmetical expressions such that
object is a polynomial
expression in the returned expressions |
RatExpr |
- | return a set of arithmetical expressions such that
object is a rational expression
in the returned expressions |
a set of arithmetical expressions.
object
collect
, domtype
, op
, poly
, rationalize
, type
, Type::PolyExpr
, Type::RatExpr
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 0
th 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 1).object
is a polynomial,
a function environment, a procedure, or a built-in
kernel function, then
indets
returns the empty set. See example 2.indets
is a function of the system kernel.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).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.object
is considered as a rational expression. Similar to PolyExpr, non-rational subexpressions are considered as
indeterminates (see example 1).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)
1/2 1 3 2 v --------- + PI (sin(y) + 1) - f(1/3) + ---- h 3 g + x[u] z
>> indets(e)
{g, h, u, v, x, y, z, PI}
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 0
-th 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
{g, h, u, v, x, y, z}
The result of indets
is substantially
different if one of the two options is specified:
>> indets(e, RatExpr)
h 1/2 {z, PI, sin(y), g , x[u], v }
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)
{ 1 1 1/2 } { PI, sin(y), --, ---------, v } { 3 h } { z g + x[u] }
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)
{x, y}, {x, exp(y)}
For tables, only the indeterminates of the entries are returned; indeterminates in the indices are ignored:
>> indets(table(x = 1 + sin(y), 2 = PI))
{y, PI}
object
is an element of a library domain T
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.