Artificial intelligent assistant

Function for a hexagonal 2-dimensional grid 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?

How about $$ f(x,y) = \cos x + \cos(\tfrac12 x +\tfrac{\sqrt 3}2y)+\cos(\tfrac12 x -\tfrac{\sqrt 3}2y)? $$ See Wolfram Alpha+%2B+cos\(x%2F2+%2B+ySqrt%5B3%5D%2F2\)+%2B+cos\(x%2F2+-+y+Sqrt%5B3%5D%2F2\)) 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.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy e1fc887fa4800502edc6a93f1e41af9d