# Testing SymPy and plot helpers are working


```python
# setup SymPy
from sympy import *
x, y, z, t = symbols('x y z t')
init_printing()

# download plot_helpers.py for use in colab
if 'google.colab' in str(get_ipython()):
    print('Downloading plot_helpers.py to util/ (only neded for colab')
    !mkdir util; wget https://raw.githubusercontent.com/minireference/noBSLAnotebooks/master/util/plot_helpers.py -P util

# setup plotting
%matplotlib inline
import matplotlib.pyplot as mpl
from util.plot_helpers import plot_vec, plot_vecs, autoscale_arrows
```


```python
# check if SymPy knows how to simplify trig expressions
simplify(sin(2*x)*cos(2*x))
```


```python
# define a column vector a
a = Matrix([1,1,1])
a
```


```python
# BAD define the floating point number approximation 1/3
1/3
```


```python
# define the fraction 1/3 (an exact rational number)
S(1)/3
```


```python
# The S()-stuff is necessary to avoid Python behaviour,
# which is to treat 1/3 as a floating point number:
type(1/3)
```




    float




```python
type(S(1)/3)
```




    sympy.core.numbers.Rational




```python

```


```python
# obtain numeric approximation (as a float)
N(S(1)/3)
```


```python
# N, .n(), and .evalf() are equivalent ways to obtain numeric approx:
N((S(1)/3)), (S(1)/3).n(), (S(1)/3).evalf()
```


```python
# the .n() method allows for arbitrary level precisions
pi.n(100)
```


```python
# Euler's constant
E
```


```python

```


```python

```

## Plot helpers


```python
# vector defined as a Python list
u = [1,2]
plot_vec(u)
autoscale_arrows()
```


```python
# vector defined as a SymPy 2x1 Matrix (a column vector)
v = Matrix([1,2])
plot_vec(v)
autoscale_arrows()
```


```python

```

303243e32ae2f42bf1533f64186948a981e66c1c
ipynb
Jupyter Notebook
Testing.ipynb
minireference/noBSLAnotebooks
3d6acb134266a5e304cb2d51c5ac4dc3eb3949b4
MIT
2016-04-20T13:56:02.000Z
2022-03-30T08:55:08.000Z
Testing.ipynb
minireference/noBSLAnotebooks
3d6acb134266a5e304cb2d51c5ac4dc3eb3949b4
MIT
2021-07-01T17:00:38.000Z
2021-07-01T19:34:09.000Z
Testing.ipynb
minireference/noBSLAnotebooks
3d6acb134266a5e304cb2d51c5ac4dc3eb3949b4
MIT
2017-02-04T05:22:23.000Z
2021-12-28T00:06:50.000Z
Qwen/Qwen-72B
1. YES
2. YES