Hello everyone,
I’m trying (and failing) to create an array with dimensions {i1,j1,k1,i2,j2,k2}, conditioned to: {i1 + j1 + k1 = n} & {i2 + j2 + k2 = n}, where n is a fixed (given) integer number.
In attachment is what I’ve done so far.
Thank you very much!
hdolhaine
(Hans Dolhaine)
March 21, 2018, 2:15pm
2
As far as I know it is a bit tricky using indices 0 accessing Table-elements
In[22]:= tt = Table[i, {i, 0, 3}]
tt[[0]]
tt[[1]]
Out[22]= {0, 1, 2, 3}
Out[23]= List
Out[24]= 0
Moreover your notebook contains a typo (Deletecases).
Is it (see notebook attached) this what you want? But then you must take into account that H [[ 2, … ]] refers to i1 = 1.
danielgrun
(Daniel Grun)
March 21, 2018, 10:40pm
3
Actually, that’s not what I was looking for - which I’ve already figured out. Thank you, anyway!
You can just create a function with inputs i1, j1, k1, i2 , j2, k2 and n to do what you want.
H[n_][i1_, j1_, k1_, i2_, j2_, k2_ ] := If [ i1 + j1 +k1 = n && i2 + j2 +k2, (* Do something *), (* Do something *)]
You can even parametrize the tasks of the conditional statement in the above code.