集合 B ={ b ∈ {±1}^N } を得たい! 僕が考えたのはこんな感じ. using Combinatorics function main(N) B=[] for n=1:N combs = collect(combinations(1:N,n)) for comb in combs b = ones(N) for com in comb b[com] = -1 end push!(B,b) end end return B end B = main(5) display(B) これを実行すれば [1.0, 1.0, 1.0, 1.0, 1.0] [-1.0, 1.0, 1.0, 1…