---
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 define any number of variables as follows.
Here we define $x$, $y$, and $z$.


```python
var( 'x y z' )
```




$\displaystyle \left( x, \  y, \  z\right)$



You can tell that they are variables, because when you ask Python to
print them out, it does not print a value (such as a number) but rather
just the symbol itself.


```python
x
```




$\displaystyle x$



And when you use a symbol inside a larger formula, it doesn't attempt to
compute a result, but stores the entire formula symbolically.


```python
formula = sqrt(x) + 5
formula
```




$\displaystyle \sqrt{x} + 5$



104fd8fe20093190b2ed518275942bb1ca62df5d
ipynb
Jupyter Notebook
database/tasks/How to create symbolic variables/Python, using SymPy.ipynb
nathancarter/how2data
7d4f2838661f7ce98deb1b8081470cec5671b03a
MIT
database/tasks/How to create symbolic variables/Python, using SymPy.ipynb
nathancarter/how2data
7d4f2838661f7ce98deb1b8081470cec5671b03a
MIT
database/tasks/How to create symbolic variables/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