最適化のために、scipy で複数の制約を使用する必要があります。
cons = ({'type': 'eq', 'fun': cons0},\
{'type': 'eq', 'fun': cons1},{'type': 'eq', 'fun': cons2}, ....)
ループで生成しようとしましたが、cons0 または cons1 または cons3 は文字列と見なされ、エラーが発生します。
cons= []
for i in range(3):
name = cons + str(i)
cons.append({'type': 'eq', 'fun': name})