In [ ]:
%load_ext autoreload
%autoreload 2
In [ ]:
from IPython.core.debugger import Tracer # debugging
from IPython.display import clear_output
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns # prettify matplotlib
from mpl_toolkits.mplot3d import Axes3D # for matplotlib 3D plots
import numpy as np
In [ ]:
# local modules
import sys; sys.path.append('../src/')
import optimisation as op
import plot3D
In [ ]:
def f(x,y):
return 1.5 * (np.sin(0.5*x)**2 * np.cos(y) + 0.1*x + 0.2*y)
X = np.linspace(-6, 6, 100)
Y = np.linspace(-5, 5, 100)
X, Y = np.meshgrid(X, Y)
Z = f(X,Y)
In [ ]:
fig = plt.figure(figsize=(16,8))
ax = fig.gca(projection='3d')
surf = ax.plot_surface(X, Y, Z, cmap='plasma', linewidth=0, antialiased=True)
fig.colorbar(surf)
plt.show()
In [ ]:
plot3D.surface3D(X,Y,Z)
plot3D.scatter3D(X,Y,Z)
In [ ]:
In [ ]: