Docs Control and automate
Python
The Python panel runs Python inside the app.
- No install, no account, no network.
- NumPy, SciPy, SymPy and Matplotlib come with the app.
- Plugins add more, like NetworkX and pandas.
Press Run, or ⌘Enter.
Show anything
| Function | Shows |
|---|---|
show(x) |
a plot, a SymPy formula, a table, or text |
show_tex(tex) |
typeset TeX |
show_html(html) |
a small page of your own |
plt.show() |
your Matplotlib plots |
A plot
Python
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 2 * np.pi, 200)
plt.plot(x, np.sin(x), label="sin x")
plt.plot(x, np.cos(x), label="cos x")
plt.legend()
plt.show()
Exact algebra
Python
from sympy import symbols, integrate, exp, oo
x = symbols("x")
show(integrate(exp(-x**2), (x, -oo, oo))) # √π, typeset
A table
Python
show_html("<table><tr><th>n</th><th>n!</th></tr><tr><td>10</td><td>3628800</td></tr></table>")
Where scripts come from
- You, in the panel.
- A lesson: a
pythonblock has Open in Python. - The Data panel: it hands your values to SymPy.
- The assistant: ask in words. It writes the script and fixes errors.
More packages
Open Plugins and install a Python library. Each one is checked before it is kept.