kill(all)$ f[i,j]:=1/(sin((j+1)*x)^(i+3)*cos((j+1)*x));

logcontract(genmatrix(f,3,3));

integrate(%,x);