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.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

**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.**

Libraries contain most of the MuPAD^{®} functionality. Each
library includes a collection of functions for solving particular
types of mathematical problems:

`combinat` | supports combinatorics operations |

`solvelib` | contains various methods used by the function `solve` |

`export` | supports exporting MuPAD data to external formats |

`output` | supports formatted output of the MuPAD data |

`fp` | supports functional programming methods |

`generate` | supports conversion of the MuPAD expressions to C, FORTRAN, MATLAB^{®},
and TeX codes |

`groebner` | supports operating on ideals of multivariate polynomial rings over a field |

`import` | supports importing external data to MuPAD |

`transform` | supports integral transformations and the discrete Z-transform |

`intlib` | supports manipulating and solving integrals |

`linalg` | supports linear algebra operations |

`linopt` | provides algorithms for linear and integer programming |

`listlib` | supports manipulating lists |

`polylib` | supports manipulating polynomials |

`stringlib` | supports manipulating strings |

`numlib` | supports number theory operations |

`numeric` | provides algorithms for numeric mathematics |

`ode` | supports manipulating and solving ordinary differential equations |

`orthpoly` | provides a set of standard orthogonal polynomials |

`Pref` | supports setting and restoring user preferences |

`prog` | provides programming utilities for analyzing functions and tracing errors |

`stats` | provides methods for statistical analysis |

`Type` | supports checking types of MuPAD objects |

`Symbol` | supports typesetting symbols |

Functions included in libraries are written in the MuPAD language.
The calling syntax for functions from all the libraries (except for
the standard library) includes both the library name and the function
name: `library::function`

.

The standard library presents the set of most frequently used
functions including `diff`

, `int`

, `simplify`

, `solve`

, and other functions.
For example:

diff(x^2,x)

You can get information about the libraries using the `info`

and `help`

commands. The info
command gives a list of functions of a particular library. For example,
the numlib library
presents a collection of functions for number theory operations:

info(numlib)

Library 'numlib': the package for elementary number theory

-- Interface:

numlib::Lambda, numlib::Omega,

numlib::checkPrimalityCertificate, numlib::contfrac,

numlib::contfracPeriodic, numlib::cornacchia,

numlib::decimal, numlib::divisors,

numlib::factorGaussInt, numlib::fibonacci,

numlib::fromAscii, numlib::g_adic,

numlib::ichrem, numlib::igcdmult,

numlib::invphi, numlib::ispower,

numlib::isquadres, numlib::issqr,

numlib::jacobi, numlib::lambda,

numlib::legendre, numlib::lincongruence,

numlib::mersenne, numlib::moebius,

numlib::mroots, numlib::msqrts,

numlib::numdivisors, numlib::numprimedivisors,

numlib::omega, numlib::order,

numlib::phi, numlib::pi,

numlib::primedivisors, numlib::primroot,

numlib::proveprime, numlib::reconstructRational,

numlib::sigma, numlib::sqrt2cfrac,

numlib::sqrtmodp, numlib::sumOfDigits,

numlib::sumdivisors, numlib::tau,

numlib::toAscii,

To see brief information about a particular library function, use the mouse pointer to hover the cursor over the function name.

For more information about the library and for information about the library functions, enter:

?numlib

To see the implementation of a library function, use the `expose`

command:

expose(numlib::tau)

proc(a) name numlib::tau; begin if args(0) <> 1 then error(message("symbolic:numlib:IncorrectNumberOfArguments")) else if not testtype(a, Type::Numeric) then return(procname(args())) else if domtype(a) <> DOM_INT then error(message("symbolic:numlib:ArgumentInteger")) end_if end_if end_if; numlib::numdivisors(a) end_proc

You can call any library function (except for the standard library
functions) using the following syntax: `library::function`

.
If you frequently use some functions that do not belong to the standard
library, it is possible to call them without specifying the library
name. The `use`

command
exports functions of the MuPAD libraries to the global namespace
allowing you to call them without using the library names. For example,
you can export the function that computes the decimal expansion of
a rational number:

use(numlib,decimal): decimal(1/3)

After exporting the decimal function, you can use it without
using the library name `numlib`

:

decimal(1/200)

To call the `info`

, `help`

, or ? commands,
use the full name of an exported function including the name of a
library:

?numlib::decimal

You cannot export a library function with the same name you use for another object:

hilbert := x: use(linalg, hilbert)

Warning: Identifier 'hilbert' is not exported because it already has a value. [use]

After clearing the variable `decimal`

, you
can export a function:

delete hilbert: use(linalg, hilbert): hilbert(3)

You also can export several functions from the same library simultaneously. For example, you can export the functions for finding the sum of digits and the set of positive divisors of an integer:

use(numlib, sumOfDigits, numdivisors): numdivisors(21); sumOfDigits(21)

To export all functions of a library, pass the library name
to the `use`

command.
If some of the library functions have name conflicts with other objects,
the `use`

command
issues a warning for each name conflict:

use(numeric)

Warning: Identifier 'product' is not exported because it already has a value. [use]

Warning: Identifier 'int' is not exported because it already has a value. [use]

Warning: Identifier 'indets' is not exported because it already has a value. [use]

Warning: Identifier 'det' is not exported because it already has a value. [use]

Warning: Identifier 'linsolve' is not exported because it already has a value. [use]

Warning: Identifier 'rationalize' is not exported because it already has a value. [use]

Warning: Identifier 'inverse' is not exported because it already has a value. [use]

Warning: Identifier 'solve' is not exported because it already has a value. [use]

Warning: Identifier 'sum' is not exported because it already has a value. [use]

Warning: Identifier 'sort' is not exported because it already has a value. [use]

These library functions have the same names as the standard
library functions. You cannot delete standard library functions and
resolve the name conflicts. Use the full function names such as `numeric::product`

to
call these functions.

Was this topic helpful?