## SymPy
Execute the following code to initialize the printing environment
```python
import sympy as sp
sp.init_printing()
```
### 1. Using `SymPy` as a calculator
1. The results can be either exact
2. Or can be evaluate to arbitrary precsion using `evalf()`
```python
i = sp.Integer(24)
r = sp.Rational(1, 3)
f = sp.Float(3.53) + sp.Float(3)
```
3. Built in special constants and functions
```python
sp.pi + sp.E
sp.oo > 99999
sp.sin(sp.pi/2)
```
| Operator | Description | Documentation |
| :------------- | :------------- | :----------- |
| `sp.subs()` |[Substitutes](https://docs.sympy.org/latest/tutorials/intro-tutorial/basic_operations.html#substitution) old for new in an expression after sympifying args. | [link](https://docs.sympy.org/latest/modules/core.html#sympy.core.basic.Basic.subs)|
| `sp.evalf()` |Evaluate the given formula to an accuracy of n digits.| [link](https://docs.sympy.org/latest/modules/core.html#module-sympy.core.evalf)|
|`sp.utilities.lambdify()`|`subs()` and `evalf()` are good if you want to do simple evaluation, but if you intend to evaluate an expression at many points, there are more efficient ways. This function provides convenient ways to transform `SymPy` expressions to `Python` expre|[link](https://docs.sympy.org/latest/modules/utilities/lambdify.html#module-sympy.utilities.lambdify)|
### 2. Defining symbols and perform symbolic operations
```python
x = sp.Symbol('x') # the symbol you create has to be specified as a string
x,y = sp.symbols('x,y') # you can create multiple symbols at once using multiple assignment
```
`SymPy` only automatically simplifies the most elementary expressions and requires the programmer to explicitly request further simplification. Therefore, several simplification functions available [here](https://docs.sympy.org/latest/tutorials/intro-tutorial/simplification.html)
| Operator | Description | Documentation |
| :------------- | :------------- | :----------- |
| `sp.expand()` |Given a polynomial, `expand()` will put it into a canonical form of a sum of monomials. | [link](https://docs.sympy.org/latest/tutorials/intro-tutorial/simplification.html#expand)|
| `sp.simplify()` |It applies all the major simplification operations in `SymPy`, and uses heuristics to determine the simplest result. But “simplest” is not a well-defined term.| [link](https://docs.sympy.org/latest/tutorials/intro-tutorial/simplification.html#simplify)|
|`sp.factor()`|Takes a polynomial and factors it into irreducible factors over the rational numbers|[link](https://docs.sympy.org/latest/tutorials/intro-tutorial/simplification.html#factor)|
### 3. Solving equations symbolically
Several functions available [here](https://docs.sympy.org/dev/guides/solving/find-roots-polynomial.html) for finding roots of polynomials.
Also checkout [here](https://docs.sympy.org/dev/guides/solving/solve-equation-algebraically.html) and [here](https://docs.sympy.org/dev/guides/solving/solve-system-of-equations-algebraically.html) for solving equations.
| Operator | Description | Documentation |
| :------------- | :------------- | :----------- |
| `sp.solve()` |General solving function which can find root|[link](https://docs.sympy.org/dev/modules/solvers/solvers.html#sympy.solvers.solvers.solve)|
| `sp.nroots()`|computes numerical approximations of the roots of any polynomial whose coefficients can be numerically evaluated, whether the coefficients are rational or irrational|[link](https://docs.sympy.org/dev/modules/polys/reference.html#sympy.polys.polytools.nroots)|
|`sp.nsolve()`|Solve a nonlinear equation system numerically. Only return one solution at a time|[link](https://docs.sympy.org/dev/modules/solvers/solvers.html#sympy.solvers.solvers.nsolve)|
### 4. Calculus with `SymPy`
You can do basic calculus tasks such as derivatives, integrals, limits, and series expansions in `SymPy`. See [here](https://docs.sympy.org/latest/tutorials/intro-tutorial/calculus.html#calculus).
| Operator | Description | Documentation |
| :------------- | :------------- | :----------- |
| `sp.Limit()`/`sp.limit(e, z, z0, dir='+')`|Computes the limit of e(z) at the point z0. `Limit` is the unevaluated object|[link](https://docs.sympy.org/latest/modules/series/series.html#sympy.series.limits.limit)|
|`sp.Derivative()`/`sp.limit(e, z, z0, dir='+')`|Differentiate f with respect to symbols. `Derivative` is the unevaluated object|[link](https://docs.sympy.org/latest/modules/core.html#sympy.core.function.diff)|
|`sp.Integral()`/`sp.integrate()`|Compute definite or indefinite integral of one or more variables. `Integral` is the unevaluated object|[link](https://docs.sympy.org/latest/modules/integrals/integrals.html)|
|`sp.series(expr,x,x0)`|Series expansion of expr around point x=x0.|[link](https://docs.sympy.org/latest/modules/series/series.html#sympy.series.series.series)|
### 5. Linear algebra with `SymPy`
You can find more information [here](https://docs.sympy.org/latest/modules/matrices/matrices.html)
| Operator | Description | Documentation |
| :------------- | :------------- | :----------- |
|`sp.Matrix()`| |[link](https://docs.sympy.org/latest/modules/matrices/matrices.html#creating-matrices)|