Function for a hexagonal 2-dimensional grid

$\begingroup$

I can make a "square" $2$D sine wave pattern with the function $f(x,y) = \cos(x) + \cos(y)$:

square grid

What is the function to make a hexagonal pattern of the same kind?

$\endgroup$

1 Answer

$\begingroup$

How about $$ f(x,y) = \cos x + \cos(\tfrac12 x +\tfrac{\sqrt 3}2y)+\cos(\tfrac12 x -\tfrac{\sqrt 3}2y)? $$ See Wolfram Alpha for a plot:

enter image description here

The idea is that $\cos(ax+by)$ will be large when $ax+by\approx 2\pi k$, and small when $ax+by\approx 2\pi k+\frac12$. This means there are periodic stripes of slope $\frac{-a}b$. In my example, the slopes of the stripes of the three summands are $\infty$ (i.e. vertical) and $\pm \frac1{\sqrt3}$, which correspond to making an angle of $\pm 30^\circ$ with the $x$ axis.

A better way of writing the same function is $$ f(x,y) = \cos x + \cos(-\tfrac12 x +\tfrac{\sqrt 3}2y)+\cos(-\tfrac12 x -\tfrac{\sqrt 3}2y) $$ and then noting that the vectors $(1,0),(-\tfrac12, \tfrac{\sqrt 3}2),(-\tfrac12, -\tfrac{\sqrt 3}2)$ are three unit vectors which meet at $120^\circ$ angles at the origin.

$\endgroup$ 3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like