output::subexpr

Abbreviates a expression

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

output::subexpr(e, <varname>)

Description

output::subexpr rewrites symbolic expression in terms of common subexpressions.

If an expression e contains common subexpressions, output::subexpr(e) returns a list that contains the abbreviated expression and the abbreviations in a form of equations. With output::subexpr you get the same abbreviations as you see in the outputs. See Example 1.

An output of this command does not depend on the current setting of Pref::abbreviateOutput.

By default, MuPAD® generates abbreviations using the # symbol followed by numbers. Using the argument varname, you can customize the names of abbreviated subexpressions. See Example 2.

Examples

Example 1

You can abbreviate an expression:

y := solve(x^3 + x + 1 = 0, x, MaxDegree = 3):
output::subexpr(y)

Example 2

You can customize the names of abbreviated subexpressions:

y := solve(x^3 + x + 1 = 0, x, MaxDegree = 3):
output::subexpr(y, t)

Parameters

e

A MuPAD expression

varname

A base name for the abbreviation variables

Return Values

List that contains the abbreviated expression and the abbreviations as equations

Was this topic helpful?