0
$\begingroup$

enter image description here

This is a 3D map that maps every $(x,y,z)\to (x',y',z')$ uniquely. If i want to implement it's discrete counterpart on matlab platform, i do the following $$\text{if} (i<=\dfrac{n}{2} \wedge j\leq \dfrac{n}{2})$$ \begin{eqnarray*} x'=2\cdot (i-1)+1\\ y'=2\cdot (j-1)+1\\ z'= \lfloor 0.25\cdot(k-\mod(k-1,2))\rfloor+1; \end{eqnarray*} The input to discretized equatin are integers and the output should also be integers that is why i have used the floor function and since the function is part of some algorithm that involves indexing that starts from $(1,1)$ ex Matlab that is why the $mod$ function is used. But this is clearly not a unique mapping because $(1,1,1)\to (1,1,1), (1,1,2)\to (1,1,1), (1,1,3)\to (1,1,1), (1,1,4)\to (1,1,1)$. So there has to be some minor adjustments or major ajdustments in the discretizing part that retains the uniqueness of the equation. Can somebody suugest ?

Edit: After the answer: I have added the code where $n=36$, but still it is not giving the unique mapping.

$\endgroup$
  • $\begingroup$ Please, don't use images as main content of your post. This makes your question impossible to search and inaccessible to the visually impaired. Please transcribe text and mathematics (note that you can use LaTeX) and don't forget to give proper attribution to your sources. Avoid using $*$ to denote multiplication as it typically denotes other operations in mathematics (e.g., convolution); use \cdot instead). $\endgroup$ – Pantelis Sopasakis May 15 at 16:10
1
$\begingroup$

This solution assumes $n$ is a multiple of $4$. Let $\def\1{{\bf 1}}\1[S]$ be a function which is equal to $1$ if the statement $S$ is true, and zero otherwise. This is a bijective mapping from the set of ordered tuples $(x,y,z)$ where each $x,y,z\in \{1,2,\dots,n\}$ to itself. $$ \begin{align} x'&=\text{mod}(2(x-1),n)+1+\1[\text{mod}(z,4)= 2\text{ or }\text{mod}(z,4)=0] \\ y'&=\text{mod}(2(y-1),n)+1+\1[\text{mod}(z,4)= 3\text{ or }\text{mod}(z,4)=0] \\ z'&=\lceil z/4\rceil + (n/4)\Big(\1[n/2<x] + 2\cdot \1[n/2<y]\Big) \end{align} $$

Brief explanation:

The $\text{mod}(2(x-1),n)+1$ part simultaneously captures the $2x$ and $2x-1$ parts of the original, similarly for the $y$.

The original problem works for continuous space, where stretching and compressing is bijective. In the discrete space, when you stretch by a factor of $2$ you leave gaps, and when you compress you get collisions. We simultaneously fix both of these problems with the $\1[n/4< z\le n/2\;\;\text{ or }\;\;3n/4< z\le n]$ and $\1[n/2 <z \le n]$ parts. Essentially, when you try to compress the $z$ part by $4$, you need to instead divide the column into four parts and move some of these parts slightly out of the way.

The expression for $z$ just captures the $z'=z/4 +\{0,1/4,1/2\text{ or }3/4\}$ all in one go.

$\endgroup$
  • $\begingroup$ Can you explain the equivalence of your answer with the given mathematical equation or just hint the main part? $\endgroup$ – Upstart May 14 at 20:02
  • $\begingroup$ @Upstart See edits. $\endgroup$ – Mike Earnest May 14 at 20:20
  • $\begingroup$ That was some reasoning, a doubt : in that $z'$ term what is that $+$ in the middle $+2\mathbf{1}$ does this mean AND? $\endgroup$ – Upstart May 14 at 20:26
  • $\begingroup$ @Upstart No, it means addition. We have ${{\bf 1}}[n/2<x]$; this is a number which is equal to $0$ or $1$. Next we have ${{\bf 1}}[n/2<y]$; this is another number which is $0$ or $1$. We multiply the second number by two, then add ($+$) the two numbers together. $\endgroup$ – Mike Earnest May 14 at 20:29
  • $\begingroup$ I have added the code that i implemented using your discretized equations, but it is still not giving the unique results, i guess there is something missing in my code, can you have a look? $\endgroup$ – Upstart May 15 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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