Python 求平方运算
2019-08-22 08:27 alpha
使用表达式 使用内置模块 使用内置函数 # 1. 表达式 c = 3**2 # 2. 内置模块 import math a = math.pow(3,2) # 3. 内置函数 b = pow(3,2) # 注意:这个不是平方,^是按位异或逻辑运算符,&是按位逻辑运算符,|是按位或逻辑运算符 d = 3^2 print(a, b, c, d) 运行结果(手动添加了换行): 9.0 9 9 1
继续阅读 »2019-08-22 08:27 alpha
使用表达式 使用内置模块 使用内置函数 # 1. 表达式 c = 3**2 # 2. 内置模块 import math a = math.pow(3,2) # 3. 内置函数 b = pow(3,2) # 注意:这个不是平方,^是按位异或逻辑运算符,&是按位逻辑运算符,|是按位或逻辑运算符 d = 3^2 print(a, b, c, d) 运行结果(手动添加了换行): 9.0 9 9 1
继续阅读 »2019-08-21 18:21 hxy
网络的异质度有很多种评价方法。这里所说的异质度,指的是网络中节点的分布是否均匀。 The network heterogeneity has been defined in various ways in the literature [1] . If we carefully analyse the heterogeneity measures proposed in the literature, it becomes clear that two different aspects of a comp...
继续阅读 »2019-08-21 16:40 hxy
在计算均值时,numpy提供了两个现成的函数,np.mean() 和 np.average() 区别在于:np.mean() 只能计算算数平均值,而np.average() 通过添加 weights 参数可以计算加权平均值。 np.mean() 源码: @array_function_dispatch(_mean_dispatcher) def mean(a, axis=None, dtype=None, out=None, keepdims=np._NoValue): """ Compute the ar...
继续阅读 »2019-08-21 15:31 hxy
关于聚类系数的原汁原味的介绍,可以参考小世界网络这篇论文 [1]: The clustering coefficient C(p) is defined as follows. Suppose that a vertex v has kv neighbours; then at most kvkv 21=2 edges can exist between them (this occurs when every neighbourof v is connected to everyother neighbo...
继续阅读 »2019-08-20 22:38 alpha
数学上,矩是一组点组成的模型的特定的数量测度。在力学和统计学中都有用到矩。 如果这些点代表质量,那么: 零阶矩表示所有点的 质量; 一阶矩表示 质心; 二阶矩表示 转动惯量。 如果这些点代表概率密度,那么: 零阶矩表示这些点的 总概率(也就是1); 一阶矩表示 期望(均值);举例: x , y x,y 坐标系中, x 取大于零的整数, y 1 , y 2 , . . . , y n y_1, y_2, ...,y_n 对应 x = 1 , 2 , . . . , n x=1, 2,..., n 的值,现...
继续阅读 »