"Polar coordinates" over a evenly spaced grid

166 Views Asked by At

Say I have a real function $f$ over an evenly spaced grid. So $f$ takes as input the integers $l,n$. Is there a way to, analogously to a function over a continuum plane, to define "polar coordinates"? The $r$ in this case will be the $L^1$ metric, i.e. the distance of $(l,n)$ from the origin will be $|l|+|n|$. What will play the role of the angle $\theta$?

2

There are 2 best solutions below

0
On BEST ANSWER

Yes, in my opinion one can indeed define "polar coordinates" for an evenly spaced grid. Of course, things will be a bit different in this geometry. You have chosen to define $r$ as follows:

$$r = |l| + |n|$$

We now seek a meaningful angle $\theta$. In order to use Pythagoras, we first define the Euclidic norm:

$$E = \sqrt{l^2 + n^2}$$

We can now write $l = E \cos (\theta)$ and $n = E \sin (\theta)$. Combining these equations we arrive at the following expressions, valid for the first quadrant:

$$\cos (\theta) = l/E = \frac {l} {\sqrt {l^2 + (r-l)^2} } $$

$$\sin (\theta) = n/E = \frac {r-l} {\sqrt {l^2 + (r-l)^2} } $$

We see that the allowed values for $\theta$ unfortunately (but not surprisingly!) depend on $r$.

0
On

In ordinary Euclidean geometry, a circle centered at the origin can be parametrized by:

$$x = r \cos(\theta)$$ $$y = r \sin(\theta)$$

Where $r$ is distance between $(x, y)$ and the origin, and $r\theta$ is the arc length along the circle, measured counterclockwise from the positive x-axis. Let's generalize this to:

$$x = r C(\theta)$$ $$y = r S(\theta)$$

Where $C$ and $S$ are the analogues to $\cos$ and $\sin$ in the relevant geometry.

In $L^1$ space, we simply have $\boxed{r = |x| + |y|}$.

For $\theta$, we can use the arc length along the “circle”, which is actually a 45° rotated square. In Euclidean geometry, this square has a side length of $\sqrt2$ units, and thus a perimeter of $4\sqrt{2}$. But measured by the $L^1$ metric itself, each side of the square is $2$ units long, and thus there are $8$ “radians” in an $L^1$ “circle”.

At the four corner points, we have:

$$C(0) = C(8) = 1, S(0) = S(8) = 0$$ $$C(2) = 0, S(2) = 1$$ $$C(4) = -1, S(4) = 0$$ $$C(6) = 0, S(6) = -1$$

And due to the shape of the “circle”, we can simply interpolate straight lines between them:

$$\text{Quadrant 1: } \theta \in [0, 2] \implies C(\theta) = 1 - \frac{\theta}{2}, S(\theta) = \frac{\theta}{2}$$ $$\text{Quadrant 2: } \theta \in [2, 4] \implies C(\theta) = 1 - \frac{\theta}{2}, S(\theta) = 2 - \frac{\theta}{2}$$ $$\text{Quadrant 3: } \theta \in [4, 6] \implies C(\theta) = \frac{\theta}{2} - 3, S(\theta) = 2 - \frac{\theta}{2}$$ $$\text{Quadrant 4: } \theta \in [6, 8] \implies C(\theta) = \frac{\theta}{2} - 3, S(\theta) = \frac{\theta}{2} - 4$$

Let's now introduce a third $L^1$ “trig” function, analogous to tangent:

$$T(\theta) := \frac{S(\theta)}{C(\theta)} = \frac{y}{x}$$

$$\text{Quadrant 1: } \theta \in [0, 2] \implies T(\theta) = \frac{\theta}{2 - \theta}$$ $$\text{Quadrant 2: } \theta \in [2, 4] \implies T(\theta) = \frac{4 - \theta}{2 - \theta}$$ $$\text{Quadrant 3: } \theta \in [4, 6] \implies T(\theta) = \frac{4 - \theta}{\theta - 6}$$ $$\text{Quadrant 4: } \theta \in [6, 8] \implies T(\theta) = \frac{\theta - 8}{\theta - 6}$$

Solving for $\theta$ in terms of $x$ and $y$ gives:

$$\text{Quadrant 1: } x \ge 0 \land y \ge 0 \implies \theta = \frac{2y}{x+y}$$ $$\text{Quadrant 2: } x \le 0 \land y \ge 0 \implies \theta = \frac{2y - 4x}{y - x} = 2 + \frac{2x}{x - y}$$ $$\text{Quadrant 3: } x \le 0 \land y \le 0 \implies \theta = \frac{4x + 6y}{x + y} = 4 + \frac{2y}{x + y}$$ $$\text{Quadrant 4: } x \ge 0 \land y \le 0 \implies \theta = \frac{6y - 8x}{y - x} = 6 + \frac{2x}{x - y}$$

These can probably be unified with creative use of absolute value and floor/ceiling operations.