Let's visualize how a Gaussian is not a convex function:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
sns.set_context('talk', font_scale=1.6)
plt.rcParams['figure.figsize'] = (10, 7)
x = np.linspace(-5, 5, 200)
y = np.exp(-x**2)
from ipywidgets import interact, FloatSlider
@interact
def _(a = FloatSlider(min=-3, max=0, value=-1), b=FloatSlider(min=0, max=3, value=1)):
plt.plot(x, y, label=r'$\exp(-x^2)$')
x0 = np.array([a, b])
y0 = np.exp(-x0**2)
plt.plot(x0, y0, 'k', lw=4)
plt.plot(x0, y0, 'ro', markersize=10)
plt.legend()