# Задания

* $f(x)=x^3+3x^2-72x+1$ Найти производную первого порядка и нарисовать график
* $f(x)=ln(2x-1)$ Найти производную 10 порядка и нарисовать график
* $f(x,y)=x^2+y^2$ Найти производную по х, по y и нарисовать графики

PS Видео решения дз не будет, смысла не вижу


```python
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from sympy import *

def showPlot(x_start, x_max, step, callback, title='Function'):
    x = np.arange(x_start, x_max, step)
    y = callback(x)

    plt.plot(x, y)
    plt.xlabel('X')
    plt.ylabel('Y')
    plt.title(title)
    plt.grid(True)
    plt.show()
    
def value_of_expr(x_vector, symbol, expr):
    y = np.empty_like(x_vector)
    for index, element  in enumerate(x_vector):
        y[index] = (expr.subs(symbol, element))
    return y

def value_of_expr_3d(x_matrix, y_matrix, x_symbol, y_symbol, expr):
    z = np.empty_like(x_matrix)
    for i_1 in range(0, z.shape[0]):
        for i_2 in range(0, z.shape[0]):
            z[i_1, i_2] = expr.subs({x_symbol: x_matrix[i_1, i_2], y_symbol: y_matrix[i_1, i_2]})
    return z
```


```python
init_printing()
x,y = symbols('x y')
```


```python
e = x**3+3*x**2-72*x+1
dx = diff(e, x)
showPlot(-10, 10, 0.1, lambda i: value_of_expr(i,x,e), 'Origin')
showPlot(-10, 10, 0.1, lambda i: value_of_expr(i,x,dx), 'Diff')
```


```python
e = log(2*x-1)
dx = diff(e, x, 10)
showPlot(4, 10, 0.1, lambda i: value_of_expr(i,x,e), 'Origin')
showPlot(4, 10, 0.1, lambda i: value_of_expr(i,x,dx), 'Diff')
```


```python
from mpl_toolkits.mplot3d import axes3d, Axes3D


fig = plt.figure()
ax = Axes3D(fig)

e = x**2 + y**2

# Make data.
X = np.arange(-5, 5, 0.25)
Y = np.arange(-5, 5, 0.25)
X, Y = np.meshgrid(X, Y)
Z = value_of_expr_3d(X, Y, x, y, e)

surf = ax.plot_surface(X, Y, Z, linewidth=0)

dx = diff(e,x)
Z = value_of_expr_3d(X, Y, x, y, dx)
surf = ax.plot_surface(X, Y, Z, linewidth=0, color='g')

dy = diff(e,y)
Z = value_of_expr_3d(X, Y, x, y, dy)
surf = ax.plot_surface(X, Y, Z, linewidth=0, color='r')

# Customize the z axis.
ax.set_zlim(0, 20)
```


```python
dx
```


```python
dy
```


```python

```

786dfe8f171af3b1dd5256bcf45f4e46fb604e3d
ipynb
Jupyter Notebook
module_002_math/lesson_002_limits/answer/Home work.ipynb
CorbenTerminator/ML
df083b768be23e53f28d160b23e6dbe8775115f2
Apache-2.0
2019-04-06T17:12:33.000Z
2021-07-29T12:35:48.000Z
module_002_math/lesson_002_limits/answer/Home work.ipynb
CorbenTerminator/ML
df083b768be23e53f28d160b23e6dbe8775115f2
Apache-2.0
2019-04-01T19:24:38.000Z
2020-01-28T09:10:37.000Z
module_002_math/lesson_002_limits/answer/Home work.ipynb
CorbenTerminator/ML
df083b768be23e53f28d160b23e6dbe8775115f2
Apache-2.0
2019-04-01T18:45:05.000Z
2022-01-20T12:32:46.000Z
Qwen/Qwen-72B
1. YES
2. YES