## `indets` -- the indeterminates of an expression

#### Introduction

`indets(`object`)` returns the indeterminates contained in `object`.

#### Call(s)

`indets(object)`
`indets(object, PolyExpr)`
`indets(object, RatExpr)`

#### Parameters

`object` | - | an arbitrary object

#### Options

`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

#### Returns

a set of arithmetical expressions.

### Overloadable:

`object`

#### Related Functions

`collect`, `domtype`, `op`, `poly`, `rationalize`, `type`, `Type::PolyExpr`, `Type::RatExpr`

#### Details

- `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).

- If `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.

#### Option: PolyExpr

- 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.

#### Option: RatExpr

- With this option, `object` is considered as a rational expression. Similar to PolyExpr, non-rational subexpressions are considered as indeterminates (see example 1).

#### 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]       }

#### Example 2

`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}

#### Background

- If `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.

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000