我需要使用Python和Mayavi可视化此函数z1^n + z2^n = 1
。该函数的参数化如下:
import numpy as np
import cmath as cm
from mayavi import mlab
e = np.e
pi = np.pi
n = 2
xi = 3
theta = np.mgrid[0:pi/2]
k1 = np.array([2,3])
k2 = np.array([0,1])
g = [0,1,2,3]
z11 = e**(((2*k1[0]*pi)/n)*1j) * (np.cos(theta*xi*1j))**(2/n)
z21 = e**(((2*k2[0]*pi)/n)*1j) * (np.sin(theta*xi*1j))**(2/n)
z12 = e**(((2*k1[0]*pi)/n)*1j) * (np.cos(theta*xi*1j))**(2/n)
z22 = e**(((2*k2[1]*pi)/n)*1j) * (np.sin(theta*xi*1j))**(2/n)
z13 = e**(((2*k1[1]*pi)/n)*1j) * (np.cos(theta*xi*1j))**(2/n)
z23 = e**(((2*k2[0]*pi)/n)*1j) * (np.sin(theta*xi*1j))**(2/n)
z14 = e**(((2*k1[1]*pi)/n)*1j) * (np.cos(theta*xi*1j))**(2/n)
z24 = e**(((2*k2[1]*pi)/n)*1j) * (np.sin(theta*xi*1j))**(2/n)
x11 = z11.real
x21 = z11.imag
x31 = z21.real
x12 = z12.real
x22 = z12.imag
x32 = z22.real
x13 = z13.real
x23 = z13.imag
x33 = z23.real
x14 = z14.real
x24 = z14.imag
x34 = z24.real
mlab.mesh(x11,x21,x31)
mlab.mesh(x12,x22,x32)
mlab.mesh(x13,x23,x33)
mlab.show()
我需要得到n = 2的图片,如下所示:
但是当我运行我的程序时,mayavi场景一无所获。