```python
# SymPy/IPython Initialization

from sympy import *
from IPython.display import display
from IPython.display import Latex
from sympy.abc import x, y, z, s, t

init_printing(use_latex=True)

# def eq(sym):
#     return Eq(sym, sym.doit())
```


```python
# Symbols

alpha_n, alpha_nm1 = symbols(r'alpha_n \alpha_{n-1}')
display(Eq(alpha_n, 2 * alpha_nm1 + 1))
```


```python
# Calculation

x, y = symbols('x y')

print(Rational(3,2) + 4)
print((x**2).subs(x, y + 1).subs(y, 4))
```


```python
# Limits

x = Symbol('x')

sin_x = Limit(sin(x)/x, x, 0)
recip = Limit(1/x, x, oo)

display(Eq(sin_x, sin_x.doit()))
display(Eq(recip, recip.doit()))
```


```python
# Derivatives

x, y = symbols('x y')

deriv = Derivative(x**3 * y, x, 2)
display(Eq(deriv, deriv.doit()))
```


```python
# Real integration

# integrate() evaluates
# Integral() creates unevaluated

r, u = symbols('r u', real=True)

indefinite = Integral(exp(u), u)
display(Eq(indefinite, indefinite.doit()))

definite = Integral(exp(-r**2), (r, -oo, oo))
display(Eq(definite, definite.doit()))
```


```python
# Integral transforms

a = Symbol('a', positive=True)
k, s, x = symbols('k s x')

lp = laplace_transform(exp(a*x), x, s)
inv_lp = inverse_laplace_transform(lp[0], s, x)
fourier = fourier_transform(exp(-abs(x)), x, k)

display(lp)
display(inv_lp)
display(fourier)
```


```python
# Complex

x = symbols('x', real=True)

display(Eq(exp(I*x), exp(I*x).expand(complex=True)))

# residues??
#TODO
```


```python
# ODEs

f = Function('f')
x, t = symbols('x, t')

# f'' + f = 0
display(dsolve(f(t).diff(t, t) + f(t), f(t)))
```


```python
# PDEs

u, X, T = map(Function, 'uXT')


#TODO



```


```python
# Recurrence relation

y = Function('y')
n = symbols('n', integer=True)

fib = y(n) - y(n-1) - y(n-2)
rsolve(fib, y(n), {y(0):0, y(1):1})
```


```python
# Latex

x = symbols('x')

print(latex(exp(2*I*pi*x)))

display(Latex(r"""\begin{eqnarray}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0 
\end{eqnarray}"""))
```

a67e55d45437d223c1285d05ac43c6df9d058fb7
ipynb
Jupyter Notebook
py/jupyter/sympy_experiments.ipynb
YodaEmbedding/experiments
567c6a1c18fac2d951fe2af54aaa4917b7d529d2
MIT
py/jupyter/sympy_experiments.ipynb
YodaEmbedding/experiments
567c6a1c18fac2d951fe2af54aaa4917b7d529d2
MIT
py/jupyter/sympy_experiments.ipynb
YodaEmbedding/experiments
567c6a1c18fac2d951fe2af54aaa4917b7d529d2
MIT
Qwen/Qwen-72B
1. YES
2. YES