Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

output::subexpr

Abbreviates a expression

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

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?