Contents

matchlib::analyze -- structure of an expression

Introduction

matchlib::analyze analyses the structure of any expression.

Call(s)

matchlib::analyze(ex <option...>)

Parameters

ex - any MuPAD expression

Options

Const = set - a set or list of expressions that will be taken as constants
Cond = list - a list of functions that will be taken to analyze the given expression
Ident = ident - an ident or the option Any

Returns

an object of the type adt::Tree

Related Functions

match, adt::Tree, prog::exprtree

Details

Option: Const = C

Option: Cond = C

Option: Ident = x

Example 1

>> X:= a^2 + x^2:
   expose(matchlib::analyze(sin(X)/cos(X)))
      1/X1*X2, {X1 = cos(a^2 + x^2), X2 = sin(a^2 + x^2)}, [cos(a^2 \
      + x^2), sin(a^2 + x^2)]
      |
      +-- cos(X3), {X3 = a^2 + x^2}, [a^2 + x^2]
      |   |
      |   `-- X4^2 + X5^2, {X4 = a, X5 = x}, [a, x]
      |       |
      |       +-- a
      |       |
      |       `-- x
      |
      `-- sin(X6), {X6 = a^2 + x^2}, [a^2 + x^2]
          |
          `-- X7^2 + X8^2, {X7 = a, X8 = x}, [a, x]
              |
              +-- a
              |
              `-- x

Subexpression of the form a^2 + x^2 are constant.

>> expose(matchlib::analyze(sin(X)/cos(X), Const = [X]))
      1/X9*X10, {X9 = cos(a^2 + x^2), X10 = sin(a^2 + x^2)}, [cos(a^\
      2 + x^2), sin(a^2 + x^2)]
      |
      +-- cos(X12), {X12 = a^2 + x^2}, [a^2 + x^2]
      |
      `-- sin(X13), {X13 = a^2 + x^2}, [a^2 + x^2]

Only expressions of the type "_mult" and "_plus" will be examined.

>> F:= X -> type(X) = "_mult" or type(X) = "_plus":
   T:= matchlib::analyze(sin(X)/cos(X), Cond = [F])
                                   Tree3
>> expose(%)
      X14*X15, {X15 = sin(a^2 + x^2), X14 = 1/cos(a^2 + x^2)}, [1/co\
      s(a^2 + x^2), sin(a^2 + x^2)]
      |
      +-- 1/cos(a^2 + x^2)
      |
      `-- sin(a^2 + x^2)

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000