M=(0,1,2,3) と N=(0,2,4,6) の 2 つのリストがあるとします。
And I wish to put into a list all the combinations of Mi,Mj,Ns,Nt (where i,j,s,t are subscripts so for i=1 M=0, i=2 M=1 etc.) such that:
C = a^(Mi+Mj) + b^(Ns+Nj)
First in the list would be
C = a^(0+0) + b^(0+0)
C = a^(1+0) + b^(0+0)
C = a^(1+0) + b^(2+0)
「for」句を4回使用するよりも、これをうまく書き出す方法はありますか?
for i from 1 to 4 do
for j from 1 to 4 do
for s from 1 to 4 do
for t from 1 to 4 do
C = a^(Mi+Mj) + b^(Ns+Nj)
end do;
end do;
end do;
end do;
配列に入れるのですが、メイプルが嫌がるから再帰を制限したい!これを 4 つの変数を持つ 2x2 配列に入れることは可能ですか?
Mi+Mj のすべての組み合わせと Ns+Nt のすべての組み合わせの 2 つのリストを作成し、それらを配列にまとめることを検討しましたが、私が望むものと似ていますが、完全には正しくありません。