## Visualising the Riemann Zeta Function

I was playing around with the Riemann zeta function from the pracma package – trying to find the best way to visualise it and specifically, its zeros. The zeta function, of course, is given by: All non-trivial values of exist for with . The way I choose to visualise it was the polar plot of for values and .

library(pracma) library(ggplot2) library(gganimate) library(dplyr)   #### Create complex set vector #### # Imaginary parts y <- seq(0, 100, len = 10001)   # Complex vector z <- 0.5 + y * 1i   #### Evaluation of Zeta function #### # Real part real_ <- Re(zeta(z))   # Imaginary part imaginary <- Im(zeta(z))   #### Plotting #### zeta_df <- data.frame(real_ = real_, imag = imaginary, frame_ = 1:10001)   g <- zeta_df %>% ggplot(aes(x = real_, y = imaginary, frame = frame_)) + geom_path(size = 1.2, aes(cumulative = T)) + geom_point(size = 2, aes(x = 0, y = 0)) gganimate(p = g, filename = "riemann.mp4", interval = 0.001, title_frame = F) }

## Compounded arithmetic in R

I was looking for an equivalent to the  += python operator in R; firstly out of curiosity and then to just not be beaten by something so simple.

In R, infix operators (operators sandwiched with %, ie,  %.%) take arguments on the left and right sides to be closer to standard arithmetic functions. Using the infix structure, I created a simple compounded arithmetic operator for addition:

%+% < - function(x, y) { eval.parent(substitute(x <- x + y)) }