Gradient 와 함수

import matplotlib
import numpy as np

import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
delta = 0.025
x = np.arange(-3.0, 3.0, delta)
y = np.arange(-2.0, 2.0, delta)
X, Y = np.meshgrid(x, y)
Z=X**2-Y**2+Y
U=2*X
V=-2*Y+1
origin = 'lower'

plt.figure()
plt.streamplot(X, Y, U, V, color='blue')
plt.title('Simplest default with labels')
CS = plt.contourf(X, Y, Z,
                  alpha=0.5,
                  cmap=plt.cm.coolwarm)
cbar = plt.colorbar(CS)
cbar.ax.set_ylabel('verbosity coefficient')
plt.show()
con2

함수의 그레디언트는 그 함수의 등위면에 수직이다.