---
author: Nathan Carter (ncarter@bentley.edu)
---

This answer assumes you have imported SymPy as follows.


```python
from sympy import *                   # load all math functions
init_printing( use_latex='mathjax' )  # use pretty math output
```

You can write a formula and plot it in just a few lines of code.


```python
var( 'x' )
formula = x**2 - 5*x + 9
plot( formula )
```

If you want to elimiate the extra bit of text after the graph,
just assign the plot to a variable, as in `p = plot( formula )`.

You can also plot more than one function on the same graph.


```python
formula2 = 10*sin(x) + 20
plot( formula, formula2 )
```

99bb6318e5f2ff906629163fb5b9ef1d21069139
ipynb
Jupyter Notebook
database/tasks/How to graph mathematical functions/Python, using SymPy.ipynb
nathancarter/how2data
7d4f2838661f7ce98deb1b8081470cec5671b03a
MIT
database/tasks/How to graph mathematical functions/Python, using SymPy.ipynb
nathancarter/how2data
7d4f2838661f7ce98deb1b8081470cec5671b03a
MIT
database/tasks/How to graph mathematical functions/Python, using SymPy.ipynb
nathancarter/how2data
7d4f2838661f7ce98deb1b8081470cec5671b03a
MIT
2021-07-18T19:01:29.000Z
2022-03-29T06:47:11.000Z
Qwen/Qwen-72B
1. YES
2. YES

