'''Visualisation of a surface in space (Experiment 15.2)
'''

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.arange(-5, 5.1, 0.1)
y = np.arange(-5, 5.1, 0.1)

X, Y = np.meshgrid(x, y)
Z = X**2./6 - Y**2./7 + X/3


fig = plt.figure()

'''The first image'''
ax = fig.add_subplot(121, projection='3d')
ax.plot_surface(X, Y, Z)
ax.set_xlim(-5, 5)
ax.set_ylim(-5, 5)
ax.set_zlim(-5, 5)

'''The second image'''
ax = fig.add_subplot(122)
ax.contour(X,Y,Z,14)
ax.set_xlim(-5, 5)
ax.set_ylim(-5, 5)

plt.show()