## `prog::exprtree` -- visualize an expression as tree

#### Introduction

`prog::exprtree(`ex`)` visualizes any MuPAD expression `ex` as tree.

#### Call(s)

`prog::exprtree(ex <, Quiet>)`

#### Parameters

`ex` | - | expression to visualize

#### Options

`Quiet` | - | suppress screen output

#### Returns

an object of type `adt::Tree`

#### Related Functions

`prog::calltree`, `adt::Tree`

#### Details

- `prog::exprtree` visualizes the tree structure of any MuPAD expression.
- Every expression in MuPAD is internally a tree. The operations are the nodes, and the operands are the leafs.

#### Option: Quiet

- With this option no output will be printed on screen. The return value of type `adt::Tree` represents the tree structure of `ex`.

#### Example 1

The example shows the structure of the expression `a + b*2 - d*(a + c)`:

    >> prog::exprtree(a + b*2 - d*(a + c))

                                   _plus
                                   |
                                   +-- a
                                   |
                                   +-- _mult
                                   |   |
                                   |   +-- b
                                   |   |
                                   |   `-- 2
                                   |
                                   `-- _mult
                                       |
                                       +-- d
                                       |
                                       +-- _plus
                                       |   |
                                       |   +-- a
                                       |   |
                                       |   `-- c
                                       |
                                       `-- -1

                                       Tree1

`Tree1` is the return value of type `adt::Tree`. This object can be exposed or taken for other operations.

The option Quiet suppresses the output, only the tree is returned:

    >> prog::exprtree(a + b*2 - d*(a + c), Quiet)

                                       Tree2

#### Changes

- new function

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