<h1>SymPy: Open Source Symbolic Mathematics</h1>


```
%load_ext sympyprinting
```


```
from __future__ import division
from sympy import *
x, y, z = symbols("x y z")
k, m, n = symbols("k m n", integer=True)
f, g, h = map(Function, 'fgh')
```

<h2>Elementary operations</h2>


```
Rational(3,2)*pi + exp(I*x) / (x**2 + y)

```


```
exp(I*x).subs(x,pi).evalf()

```


```
e = x + 2*y
```


```
srepr(e)
```




    Add(Symbol(&apos;x&apos;), Mul(Integer(2), Symbol(&apos;y&apos;)))




```
exp(pi * sqrt(163)).evalf(50)
```

<h2>Algebra<h2>


```
((x+y)**2 * (x+1)).expand()
```


```
a = 1/x + (x*sin(x) - 1)/x
display(a)
simplify(a)
```


```
solve(Eq(x**3 + 2*x**2 + 4*x + 8, 0), x)
```




    [-2⋅ⅈ, 2⋅ⅈ, -2]




```
a, b = symbols('a b')
Sum(6*n**2 + 2**n, (n, a, b))
```

<h2>Calculus</h2>


```
limit((sin(x)-x)/x**3, x, 0)
```


```
(1/cos(x)).series(x, 0, 6)
```


```
diff(cos(x**2)**2 / (1+x), x)
```


```
integrate(x**2 * cos(x), (x, 0, pi/2))
```


```
eqn = Eq(Derivative(f(x),x,x) + 9*f(x), 1)
display(eqn)
dsolve(eqn, f(x))
```

650b9291537b166ff3d4655fe5673e07652a4d9f
ipynb
Jupyter Notebook
docs/examples/notebooks/sympy.ipynb
tinyclues/ipython
71e32606b0242772b81c9be0d40751ba47d95f2c
BSD-3-Clause-Clear
2016-05-26T10:57:18.000Z
2016-05-26T10:57:18.000Z
docs/examples/notebooks/sympy.ipynb
adgaudio/ipython
a924f50c0f7b84127391f1c396326258c2b303e2
BSD-3-Clause-Clear
docs/examples/notebooks/sympy.ipynb
adgaudio/ipython
a924f50c0f7b84127391f1c396326258c2b303e2
BSD-3-Clause-Clear
Qwen/Qwen-72B
1. YES
2. YES