2-1

陈元元發表於2024-10-08

import math
import pylab as plt
import numpy as np
plt.rc('text', usetex=True)
x = np.linspace(-10, 10, 100)
y1 = np.cosh(x)
y2 = np.sinh(x)
y3 = math.e**x/2
plt.plot(x, y1, label='$\mathrm{cosh}(x)$')
plt.plot(x, y2, label='$\mathrm{sinh}(x)$')
plt.plot(x, y3, label='$\frac{1}{2} \cdot e^x$')
plt.legend()
plt.xlabel('$x$')
plt.ylabel('$y$')
plt.show()