---
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
```

Let's create an equation with many variables.


```python
var('P V n R T')
ideal_gas_law = Eq( P*V, n*R*T )
ideal_gas_law
```




$\displaystyle P V = R T n$



To isolate one variable, call the `solve` function, and pass that variable
as the second argument.


```python
solve( ideal_gas_law, R )
```




$\displaystyle \left[ \frac{P V}{T n}\right]$



The brackets surround a list of all solutions---in this case, just one.
That solution is that $R=\frac{PV}{Tn}$.

45165b5930c81a8b6f1b0f6116a1dc189f537dc9
ipynb
Jupyter Notebook
database/tasks/How to isolate one variable in an equation/Python, using SymPy.ipynb
nathancarter/how2data
7d4f2838661f7ce98deb1b8081470cec5671b03a
MIT
database/tasks/How to isolate one variable in an equation/Python, using SymPy.ipynb
nathancarter/how2data
7d4f2838661f7ce98deb1b8081470cec5671b03a
MIT
database/tasks/How to isolate one variable in an equation/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