# Sympy in Colab Example

Rendering sympy equations requires MathJax to be available within each cell output. The following is a function that will make this happen.


```python
from IPython.display import Math, HTML
def enable_sympy_in_cell():
  display(HTML(""))
get_ipython().events.register('pre_run_cell', enable_sympy_in_cell)
```





After registering this hook, SymPy rendering will work correctly:



```python
import sympy
from sympy import *
init_printing()

x, y, z = symbols('x y z')
Integral(sqrt(1/x), (x, 0, oo))
```


```python

```

e0f65468422c39f63d9f26aea8d17e7f93095cc0
ipynb
Jupyter Notebook
SymPyInColab.ipynb
RonSheely/jupyter-notebooks
8d9b37503e59675d392f9b7c3a5a71a1c73a5373
MIT
SymPyInColab.ipynb
RonSheely/jupyter-notebooks
8d9b37503e59675d392f9b7c3a5a71a1c73a5373
MIT
SymPyInColab.ipynb
RonSheely/jupyter-notebooks
8d9b37503e59675d392f9b7c3a5a71a1c73a5373
MIT
Qwen/Qwen-72B
1. YES
2. YES