关于阿贝尔群的计算。
abelian的Python项目详细描述
abelian是一个python库,用于对基本的局部紧阿贝尔群(lcas)进行计算。 基本lca是r,z,t=r/z,z_n和它们的直接和。 在这些群上定义了傅里叶变换。 使用abelian可以采样、周期化和执行傅立叶变换 利用群间同态分析初等生命周期评价
类和方法
下面列出了最重要的课程该软件包含许多其他未列出的功能和方法
- 类{tt3}$表示基本生命周期,即R,Z,T=R/Z,Z和这些组的直接和。
- 基本方法:同一lca,直接和,等式,同构,元素投影,庞特瑞亚金对偶。
- 类HomLCA表示LCA之间的同态。
- 基本方法:恒等态射,零态射,相等,合成,求值,叠加,元素操作,核,共核,象,共象,对偶(伴随)态射。
- 类LCAFunc表示从LCAs到复数的函数。
- 基本方法:求值、构图、移位(平移)、向后拉、向前推、逐点操作(即加法)。
示例
下面的例子展示了六边形晶格的傅里叶分析
我们在r^2上创建了一个高斯函数,并为采样创建了一个同态。
fromabelianimportLCA,HomLCA,LCAFunc,voronoifrommathimportexp,pi,sqrtZ=LCA(orders=[0],discrete=[True])R=LCA(orders=[0],discrete=[False])# Create the Gaussian function on R^2function=LCAFunc(lambdax:exp(-pi*sum(j**2forjinx)),domain=R**2)# Create an hexagonal sampling homomorphism (lattice on R^2)phi=HomLCA([[1,1/2],[0,sqrt(3)/2]],source=Z**2,target=R**2)phi=phi*(1/7)# Downcale the hexagonfunction_sampled=function.pullback(phi)
下,我们近似高斯的二维积分。
# Approximate the two dimensional integral of the Gaussianscaling_factor=phi.A.det()integral_sum=0forelementinphi.source.elements_by_maxnorm(list(range(20))):integral_sum+=function_sampled(element)print(integral_sum*scaling_factor)# 0.999999997457763
使用FFT近似高斯变换的傅立叶变换。
# Sample, periodize and take DFT of the Gaussianphi_p=HomLCA([[10,0],[0,10]],source=Z**2,target=Z**2)periodized=function_sampled.pushforward(phi_p.cokernel())dual_func=periodized.dft()# Interpret the output of the DFT on R^2phi_periodize_ann=phi_p.annihilator()# Compute a Voronoi transversal function, interpret on R^2sigma=voronoi(phi.dual(),norm_p=2)factor=phi_p.A.det()*scaling_factortotal_error=0forelementindual_func.domain.elements_by_maxnorm():value=dual_func(element)coords_on_R=sigma(phi_periodize_ann(element))# The Gaussian is invariant under Fourier transformation, so we can# compare the error using the analytical expressiontrue_val=function(coords_on_R)approximated_val=abs(value)total_error+=abs(true_val-approximated_val*factor)asserttotal_error<10e-15
有关更多示例和信息,请参见the documentation。