Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

ζ[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.

share|improve this answer
    
Thanks a lot! I'm not sure what your last comment means but I think what you wrote is perfect. –  jorgen Jun 11 '13 at 16:47
    
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. –  tchronis Jun 11 '13 at 16:52
    
Ok! I see what you mean. –  jorgen Jun 11 '13 at 16:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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