Previous Page Next Page Contents

prog::find -- find operands of expressions

Introduction

prog::find(ex, opr) returns all ``paths'' to the operand opr in the expression ex.

Call(s)

prog::find(ex, opr)

Parameters

ex - any MuPAD expression of type DOM_EXPR
opr - any MuPAD object

Returns

a list of numbers that determine the position of the given object inside of the given expression, or a sequence of lists, if the expression contains the object several times

Related Functions

op, subsop, prog::exprtree

Details

Example 1

The identifier a is the first operand of the expression:

>> prog::find(a + b + c, a)
                                    [1]

The number 1 occurs several times:

>> prog::find(f(1, 1, 1), 1)
                               [1], [2], [3]

Example 2

The identifier a is the first operand of the second operand of the first operand of the expression:

>> prog::find(b*(a - 1) + b*(x - 1), a)
                                 [1, 2, 1]

The result of prog::find can be used to access the element with op or replace it with subsop:

>> op(b*(a - 1) + b*(x - 1), [1, 2, 1]);
   subsop(b*(a - 1) + b*(x - 1), [1, 2, 1] = A)
                                     a
      
                           b (A - 1) + b (x - 1)

Background

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000