I need to translate the following MATLAB code to SymPy, but, I cannot find an easy and straightforward answer:

```matlab
syms E A L P

long = [L;  L/2;  L/3];

LaG = [1 3
       2 3
       3 4];

k = E.*A./long;

K = sym(zeros(4));
for e = 1:3       
   idx = LaG(e,:);
   K(idx,idx) = K(idx,idx) + k(e)*[1 -1; -1 1]; 
end;

```

However, I cannot find in SymPy a command like NumPy's `np.ix_()`. Without this, my code will look too much complicated, and I will have to resort to MATLAB's symbolic toolbox for my entire course, since many of my codes rely on that `ix_()` function.