0
$\begingroup$

I would like to make a function of three parameters $i$, $j$ and $k$ that displays a list of integers fulfilling some criteria. Specifically the set of integers is:

$\zeta_{ijk} = \Big\{p\in\{2j+2,2j+3,\ldots,2k+2\}\ |\ $ $p=2i+1,\ \text{or}\ p\leq i+j,\ \text{or}\ p\geq i+k+3 \Big\}$

for $k\in\{0,1,\ldots\}$, $\ j \in \{0,1,\ldots,k\}$ and $i\in\{j,j+1,\ldots,k+1\}$.

where $|$ denotes that constrictions on $p$ follows. To clarify, some examples are:

$\zeta_{000}=\zeta_{100}=\emptyset$

$\zeta_{001}=\{4\}$, $\ \zeta_{101}=\{3\}$, $\ \zeta_{201}=\{2\}$

$\zeta_{111}=\zeta_{211}=\emptyset$

$\zeta_{002}=\{5,6\}$, $\ \zeta_{102}=\{3,6\}$, $\ \zeta_{202}=\{2,5\}$, $\ \zeta_{302}=\{2,3\}$

And so on. I have problems implementing the logical constrictions in e.g. the Table-function, inside my user-defined function. Any ideas?

$\endgroup$

1 Answer 1

3
$\begingroup$

ζ[i_, j_, k_] := Select[ Table[p, {p, 2 j + 2, 2 k + 2}] , (# == 2 i + 1 || # <= i + j || # >= i + k + 3) & ]

will produce your function. Also for more control, conditions must be added to be complete concerning the domain.

$\endgroup$
3
  • $\begingroup$ Thanks a lot! I'm not sure what your last comment means but I think what you wrote is perfect. $\endgroup$
    – jorgen
    Jun 11, 2013 at 16:47
  • $\begingroup$ Your domain is : k∈{0,1,…}, j∈{0,1,…,k} and i∈{j,j+1,…,k+1} so you could add in the conditions : (# == 2 i + 1 || # <= i + j || # >= i + k + 3) && (k>=0 && j>=0 && j<=k && i>=j && i<=k+1)& . But if you control correctly i,j,k it is not a problem. $\endgroup$
    – tchronis
    Jun 11, 2013 at 16:52
  • $\begingroup$ Ok! I see what you mean. $\endgroup$
    – jorgen
    Jun 11, 2013 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.