2-5

陈元元發表於2024-10-08

import numpy as np
import matplotlib.pyplot as plt
a = 2
b = np.sqrt(10)
c = np.sqrt(8)
phi = np.arange(0, 2*np.pi+0.1, 0.1)
theta = np.arange(-1, 1.1, 0.1)[:, np.newaxis]
x = a * np.cosh(theta) * np.cos(phi)
y = b * np.cosh(theta) * np.sin(phi)
z = c * np.sinh(theta)
fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.plot_surface(x, y, z, cmap='viridis')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
ax.set_box_aspect([1, 1, 1])
ax.set_title('$\frac{x2}{4}+\frac{y2}{10}-\frac{z^2}{8}=1$')
plt.show()