```python
import numpy as np
from scipy.misc import derivative
def f(x): return x**5
derivative(f, 1.0, dx=1e-6, order=15)
```




    4.9999999998068354




```python
derivative(f, 1.0, dx=1e-6, order=15, n=2)
```




    19.999127035691139




```python
p = np.poly1d([1,0,0,0,0,0]);
print (p)

np.polyder(p,1)(1.0)
p.deriv()(1.0)

np.polyder(p,2)(1.0)
p.deriv(2)(1.0)
```

       5
    1 x





    20.0




```python
from sympy import diff, symbols
x = symbols('x', real=True)
diff(x**5, x)
```




    5*x**4




```python
diff(x**5, x, x)
```




    20*x**3




```python
diff(x**5, x).subs(x, 1.0) 
```




    5.00000000000000




```python
diff(x**5, x, x).subs(x, 1.0)
```




    20.0000000000000




```python
def g(x): return np.exp(-x) * np.sin(x)
derivative(g, 1.0, dx=1e-6, order=101)

from sympy import sin as Sin, exp as Exp
diff(Exp(-x) * Sin(x), x).subs(x, 1.0)
```




    -0.110793765306699




```python
y, z = symbols('y z', real=True)
diff(Exp(x * y * z), z, z, y, x).subs({x:1.0, y:1.0, z:2.0})
```




    133.003009780752




```python

```

def7d9afba526565e03e52d3dfc2eed1e71bed02
ipynb
Jupyter Notebook
Chapter08/Differentiation.ipynb
PacktPublishing/SciPy-Recipes
fdea8e3bd6b161402ed824624819aa788e544eed
MIT
2017-12-28T05:01:19.000Z
2021-11-08T13:10:39.000Z
Chapter08/Differentiation.ipynb
PacktPublishing/SciPy-Recipes
fdea8e3bd6b161402ed824624819aa788e544eed
MIT
Chapter08/Differentiation.ipynb
PacktPublishing/SciPy-Recipes
fdea8e3bd6b161402ed824624819aa788e544eed
MIT
2017-12-24T09:25:55.000Z
2020-02-17T22:57:17.000Z
Qwen/Qwen-72B
1. YES
2. YES