阅读下列python 3代码 import math import numpy as np x = np.resize(np.random.rand(10000), [5000,2]) u = 2.0 * x -1.0 s = np.sum(u*u, axis=1) result = np.array([math.sqrt((-2.0*math.log(s[ss]))/s[ss])*u[ss,:] for ssin range(s.size)if s[ss]<1]) Result的结果服从什么分布(几维的什么样的分布)? 为什么? 阐述这段代码的问题,避免for循环,并改写这段代码。
区块链毕设网qklbishe.com为您提供问题的解答
阅读下列python 3代码
import math
import numpy as np
x = np.resize(np.random.rand(10000), [5000,2])
u = 2.0 * x -1.0
s = np.sum(u*u, axis=1)
result = np.array([math.sqrt((-2.0*math.log(s[ss]))/s[ss])*u[ss,:]
for ssin range(s.size)if s[ss]<1])
Result的结果服从什么分布(几维的什么样的分布)?
为什么?
阐述这段代码的问题,避免for循环,并改写这段代码。