When computing with Symbolic Math Toolbox™, you can choose
to work in the MATLAB^{®} Command Window or in the MuPAD^{®} Notebook
app. The MuPAD engine that performs all symbolic computations
is the same for both interfaces. The choice of the interface mostly
depends on your preferences.

Working in the MATLAB Command Window lets you perform all
symbolic computations using the familiar MATLAB language. The
toolbox contains hundreds of MATLAB symbolic functions for common
tasks, such as differentiation, integration, simplification, transforms,
and equation solving. If your task requires a few specialized symbolic
functions not available directly from this interface, you can use `evalin`

or `feval`

to
call MuPAD functions. See Call Built-In MuPAD Functions from MATLAB.

Working in the MATLAB Command Window is recommended if you use other toolboxes or MATLAB as a primary tool for your current task and only want to embed a few symbolic computations in your code.

Working in the MuPAD Notebook app requires you to use the MuPAD language, which is optimized for symbolic computations. In addition to solving common mathematical problems, MuPAD functions cover specialized areas, such as number theory and combinatorics. Also, for some computations the performance is better in the MuPAD Notebook app than in the MATLAB Command Window. The reason is that the engine returns the results in the MuPAD language. To display them in the MATLAB Command Window, the toolbox translates the results to the MATLAB language.

Working in the MuPAD Notebook app is recommended when your task mainly consists of symbolic computations. It is also recommended if you want to document your work and results, for example, embed graphics, animations, and descriptive text with your calculations. Symbolic results computed in the MuPAD Notebook app can be accessed from the MATLAB Command Window, which helps you integrate symbolic results into larger MATLAB applications.

Learning the MuPAD language and using the MuPAD Notebook app for your symbolic computations provides the following benefits.

By default, the MuPAD Notebook app displays results in typeset math making them look very similar to what you see in mathematical books. In addition, the MuPAD Notebook app

Uses standard mathematical notations in output expressions.

Uses abbreviations to make a long output expression with common subexpressions shorter and easier to read. You can disable abbreviations.

Wraps long output expressions, including long numbers, fractions and matrices, to make them fit the page. If you resize the notebook window, MuPAD automatically adjusts outputs. You can disable wrapping of output expressions.

Alternatively, you can display pretty-printed outputs similar
to those that you get in the MATLAB Command Window when you use `pretty`

. You can also display outputs
as plain text. For details, see Use Different Output Modes.

In a MuPAD notebook, you can copy or move output expressions, including expressions in typeset math, to any input or text region within the notebook, or to another notebook. If you copy or move an output expression to an input region, the expression appears as valid MuPAD input.

The MuPAD Notebook app provides very extensive graphic capabilities to help you visualize your problem and display results. Here you can create a wide variety of plots, including:

2-D and 3-D plots in Cartesian, polar, and spherical coordinates

Plots of continuous and piecewise functions and functions with singularities

Plots of discrete data sets

Surfaces and volumes by using predefined functions

Turtle graphics and Lindenmayer systems

Animated 2-D and 3-D plots

Graphics in the MuPAD Notebook app is interactive. You can explore and edit plots, for example:

Change colors, fonts, legends, axes appearance, grid lines, tick marks, line, and marker styles.

Zoom and rotate plots without reevaluating them.

Display coordinates of any point on the plot.

After you create and customize a plot, you can export it to various vector and bitmap file formats, including EPS, SVG, PDF, PNG, GIF, BMP, TIFF, and JPEG. The set of the file formats available for exporting graphics from a MuPAD notebook can be limited by your operating system.

You can export animations as AVI files (on Windows^{®} systems),
as animated GIF files, or as sequences of static images.

While both MATLAB and MuPAD interfaces provide functions for performing common mathematical tasks, MuPAD also provides functions that cover many specialized areas. For example, MuPAD libraries support computations in the following areas:

Combinatorics

Graph theory

Gröbner bases

Linear optimization

Polynomial algebra

Number theory

Statistics

MuPAD libraries also provide large collections of functions for working with ordinary differential equations, integral and discrete transforms, linear algebra, and more.

Most functions for performing common mathematical computations
are available in both MATLAB and MuPAD interfaces. For example,
you can solve equations and systems of equations using `solve`

,
simplify expressions using `simplify`

, compute integrals
using `int`

, and compute limits using `limit`

.
Note that although the function names are the same, the syntax of
the function calls depends on the interface that you use.

Results of symbolic computations can be very long and complicated,
especially because the toolbox assumes all values to be complex by
default. For many symbolic functions you can use additional parameters
and options to help you limit the number and complexity and also to
control the form of returned results. For example, `solve`

accepts
the `Real`

option that lets you restrict all symbolic
parameters of an equation to real numbers. It also accepts the `VectorFormat`

option
that you can use to get solutions of a system as a set of vectors.

Typically, the functions available in MuPAD accept more
options than the analogous functions in the MATLAB Command Window.
For example, in MuPAD you can use the `VectorFormat`

option.
This option is not directly available for the `solve`

function
called in the MATLAB Command Window.

The MuPAD programming language supports multiple programming styles, including imperative, functional, and object-oriented programming. The system includes a few basic functions written in C++, but the majority of the MuPAD built-in functionality is implemented as library functions written in the MuPAD language. You can extend the built-in functionality by writing custom symbolic functions and libraries, defining new function environments, data types, and operations on them in the MuPAD language. MuPAD implements data types as domains (classes). Domains with similar mathematical structure typically belong to a category. Domains and categories allow you to use the concepts of inheritance, overloading methods and operators. The language also uses axioms to state properties of domains and categories.

Object-Oriented Programming contains information to get you started with object-oriented programming in MuPAD.

Was this topic helpful?