Documentation

This is machine translation

Translated by
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.

pretty

Prettyprint symbolic expressions

`pretty` is not recommended. Use Live Scripts instead. Live Scripts provide full math rendering while `pretty` uses plain-text formatting. See What Is a Live Script? (MATLAB)

Syntax

```pretty(X) ```

Description

`pretty(X)` prints `X` in a plain-text format that resembles typeset mathematics. For true typeset rendering, use Live Scripts instead. See What Is a Live Script? (MATLAB)

Examples

The following statements:

```A = sym(pascal(2)) B = eig(A) pretty(B)```

return:

```A = [ 1, 1] [ 1, 2] B = 3/2 - 5^(1/2)/2 5^(1/2)/2 + 3/2 / 3 sqrt(5) \ | - - ------- | | 2 2 | | | | sqrt(5) 3 | | ------- + - | \ 2 2 /```

Solve this equation, and then use `pretty` to represent the solutions in the format similar to typeset mathematics:

```syms x s = solve(x^4 + 2*x + 1, x,'MaxDegree',3); pretty(s)```

For better readability, `pretty` uses abbreviations when representing long expressions:

```/ -1 \ | | | 2 1 | | #2 - ---- + - | | 9 #2 3 | | | | 1 #2 1 | | ---- - #1 - -- + - | | 9 #2 2 3 | | | | 1 #2 1 | | #1 + ---- - -- + - | \ 9 #2 2 3 / where / 2 \ sqrt(3) | ---- + #2 | 1i \ 9 #2 / #1 == ------------------------ 2 / sqrt(11) sqrt(27) 17 \1/3 #2 == | ----------------- - -- | \ 27 27 /```

Introduced before R2006a

Was this topic helpful?

Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos