Previous Page Next Page Contents

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

Option: PolyExpr

Option: RatExpr

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

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000