# pretty

Prettyprint symbolic expressions

pretty(X)

## Description

pretty(X) prints symbolic output of X in a format that resembles typeset mathematics.

## 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 /