# Chapter 4 Printing

Sympyではキレイに出力することができる！

詳しい内容については:
    http://docs.sympy.org/latest/tutorial/printing.html 参照.

## 4.1 'Pretty Printing'の設定


```python
from sympy import init_printing
```


```python
init_printing()
```

--->自分の環境で最適な出力(`LaTeX`, `MathML`など)を自動的に選ぶ.


```python
from sympy import init_session
```


```python
init_session() #前章参照
```

    IPython console for SymPy 1.0 (Python 3.6.0-64-bit) (ground types: python)
    
    These commands were executed:
    >>> from __future__ import division
    >>> from sympy import *
    >>> x, y, z, t = symbols('x y z t')
    >>> k, m, n = symbols('k m n', integer=True)
    >>> f, g, h = symbols('f g h', cls=Function)
    >>> init_printing()
    
    Documentation can be found at http://docs.sympy.org/1.0/


コンソールで実行すると`LaTeX`等で出力され、`jupyter notebook`では


```python
from sympy import *
x, y, z = symbols('x y z')
init_printing()
```


```python
Integral(sqrt(1/x), x)
```

とキレイに出力される！

latexで出力させたいときは


```python
print(latex(Integral(sqrt(1/x), x)))
```

    \int \sqrt{\frac{1}{x}}\, dx


とすればよい.(ちゃんと被積分関数とdxの間に\,が入ってるのがすごい.)

次は[Chapter5 Simplifications](https://hiroyuki827.github.io/SymPy_tutorial/Chapter5_Simplifications.html)へ!

ipynb
a3ad4677b20b4afcd91a08a1130ad48c4af4bf57
Jupyter Notebook
8423ceab49482dc83c90c4cb1d388cad100ced84
BSD-3-Clause
hiroyuki827/SymPy_tutorial
Chapter4_Printing.ipynb
8423ceab49482dc83c90c4cb1d388cad100ced84
2018-06-13T08:15:45.000Z
2018-06-12T03:51:09.000Z
BSD-3-Clause
hiroyuki827/SymPy_tutorial
Chapter4_Printing.ipynb
8423ceab49482dc83c90c4cb1d388cad100ced84
BSD-3-Clause
hiroyuki827/SymPy_tutorial
Chapter4_Printing.ipynb
2021-05-05T13:48:49.000Z
2018-01-02T16:53:11.000Z