一道数学题让画图,我也不会,找朋友帮我写了一下,然后他就给了我这就忙去了
是这样吗?
import math
import numpy as np
x = np.linspace(1, 50)
y = np.linspace(1, 5)
u1 = 0
u2 = 0
s1 = 1
s2 = 1
p = 0
part1 = 2 * math.pi * s1 * s1 * (1 - p ** 2) ** 0.5
part2 = -1 / (2 * (1 - p ** 2))
part3 = (x - u1) ** 2 / s1 ** 2
part4 = 2 * p * (x - u1) * (y - u2) / (s1 * s2)
part5 = (y - u2) **2 / s2 ** 2
z = 1 / part1 * math.e ** (part2 * (part3 - part4 + part5))
import matplotlib.pyplot as plt
fig = plt.figure()
ax = plt.axes(projection = '3d')
ax.plot3D(x, y, z, 'red')
plt.show()