```python
from __future__ import print_function
```

# Lecture 10
# SymPy - the Python Computer Algebra System
# pydoe - DOE in Python



```python
from time import time
import numpy as np
```


```python
x = np.random.random(10000000)

```


```python
t0 = time()
y = [2.0*i for i in x]; y = np.array(y)
print(time()-t0)
```

    2.07593607903



```python
t1 = time()
y = 2.0*x
print(time()-t1)
```

    0.0170731544495



```python
my_string = 'jadfad sdfasdf assdfa 1.0 adfa asdfasd\n'
my_string = my_string.split(' ')
my_number = float(my_string[3])
print(my_number)
```

    1.0



```python
from sympy import *
```


```python
w, x, y, z = symbols('w x y z')
```


```python
print(w)
```

    w



```python
a = 3.0*x**2 + 1.0*x
```


```python
a
```




    3.0*x**2 + 1.0*x




```python
1.0/3.0
```




    0.3333333333333333




```python
Rational(1,3)
```




    1/3




```python
a
```




    3.0*x**2 + 1.0*x




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




    3.0*y**4 + 1.0*y**2




```python
a
```




    3.0*x**2 + 1.0*x




```python
Rational?
```


```python
b = a.subs(x,y**2)
```


```python
b
```




    3.0*y**4 + 1.0*y**2




```python
a
```




    3.0*x**2 + 1.0*x




```python
a = a.subs(x,y**2)
```


```python
a
```




    3.0*y**4 + 1.0*y**2




```python
init_printing()
```


```python
a
```


```python
latex(a)
```




    '3.0 y^{4} + 1.0 y^{2}'




```python
init_printing(use_latex=False, use_unicode=False)
```


```python
a
```




         4        2
    3.0*y  + 1.0*y 




```python
print(a)
```

    3.0*y**4 + 1.0*y**2



```python
pprint(a)
```

         4        2
    3.0*y  + 1.0*y 



```python
pprint(a.integrate(x))
```

      /     4        2\
    x*\3.0*y  + 1.0*y /



```python

```

8e53d0cc20585b29fa51ff5f79ab0f9ed7e7cfcf
ipynb
Jupyter Notebook
lectures/lecture10/lecture10.ipynb
mateusza/Introduction-to-Python-Numerical-Analysis-for-Engineers-and-Scientist
a27144cc8742e67af215e8de781bd208cc1f7436
MIT
2017-11-28T15:08:25.000Z
2022-03-26T13:59:49.000Z
lectures/lecture10/lecture10.ipynb
mateusza/Introduction-to-Python-Numerical-Analysis-for-Engineers-and-Scientist
a27144cc8742e67af215e8de781bd208cc1f7436
MIT
2017-12-16T19:41:39.000Z
2017-12-16T19:41:39.000Z
lectures/lecture10/lecture10.ipynb
mateusza/Introduction-to-Python-Numerical-Analysis-for-Engineers-and-Scientist
a27144cc8742e67af215e8de781bd208cc1f7436
MIT
2017-12-15T19:19:53.000Z
2022-03-01T23:36:55.000Z
Qwen/Qwen-72B
1. YES
2. YES