# Symbolic Manipulation

Most computer mathematical work directly manipulates numbers.  Symbolic manipulation or computer algebra is using a computer to manipulate algebraic equations.

You can do many algebraic and calculus operations.

You can learn more [here](http://docs.sympy.org/dev/tutorial/).


```python
import sympy

# this makes for mathematical typesetting
sympy.init_printing()

# defines symbols
x = sympy.symbols('x')
y = sympy.symbols('y')
```

We can define a polynomial.


```python
expr = x**2 + 2*x + 1
expr
```

We can do some algebraic manipulations.


```python
expr.factor()
```

Here is an example of integration


```python
expr.integrate(x)
```

Here is a substitution


```python
expr.subs(x, y**2)
```

You can also make numerical substitutions for a variable.


```python
expr.subs(x, 1)
```


```python

```

c2f59004abc0efc562181b415dad87b2b7036401
ipynb
Jupyter Notebook
9-symbolic-manipulation.ipynb
dsoto/computing-tutorial
de029ee92e6ad1f0705de27a1bfe61a1d16806ce
CC-BY-4.0
2016-02-15T13:34:42.000Z
2016-02-15T13:34:42.000Z
9-symbolic-manipulation.ipynb
dsoto/computing-tutorial
de029ee92e6ad1f0705de27a1bfe61a1d16806ce
CC-BY-4.0
9-symbolic-manipulation.ipynb
dsoto/computing-tutorial
de029ee92e6ad1f0705de27a1bfe61a1d16806ce
CC-BY-4.0
Qwen/Qwen-72B
1. YES
2. YES