试图建立我认为是一个列联表,请考虑以下几点:
dist = Parallelize[Table[RandomVariate[NormalDistribution[]], {100000}]];
dist2 = Rest@FoldList[0.95 # + #2 &, 0, dist];
dist3 = Rest@FoldList[0.95 # + Abs[#2] &, 0, dist];
dist4 = {dist2, dist3}\[Transpose]
q1 = Flatten[{Quantile[dist2, {1/3, 2/3}], Quantile[dist3, {1/3, 2/3}]}]
{-1.39001, 1.33851, 15.0327, 16.6757}
我需要做的:对于 dist4 的每个元素,我需要查看它所属的下面的 9 个框:
for example : {1.55191, 15.7189} belongs to 2
1.55 belongs to 1 and
15.71 belongs to 8
So the intersection is 2.
我尝试过 If 或 Switch,但写起来太长了。有没有自动的方法来做到这一点?