View source: R/conformalMaps.R
disk2H | R Documentation |
Conformal map from the unit disk to the upper half-plane. The function is vectorized.
disk2H(z)
z |
a complex number in the unit disk |
A complex number in the upper half-plane.
# map the disk to H and calculate kleinj
f <- function(x, y) {
z <- complex(real = x, imaginary = y)
K <- rep(NA_complex_, length(x))
inDisk <- Mod(z) < 1
K[inDisk] <- kleinj(disk2H(z[inDisk]))
K
}
n <- 1024L
x <- y <- seq(-1, 1, length.out = n)
Grid <- expand.grid(X = x, Y = y)
K <- f(Grid$X, Grid$Y)
dim(K) <- c(n, n)
# plot
if(require("RcppColors")) {
img <- colorMap5(K)
} else {
img <- as.raster(1 - abs(Im(K))/Mod(K))
}
opar <- par(mar = c(0, 0, 0, 0))
plot(NULL, xlim = c(0, 1), ylim = c(0, 1), asp = 1,
axes = FALSE, xaxs = "i", yaxs = "i", xlab = NA, ylab = NA)
rasterImage(img, 0, 0, 1, 1)
par(opar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.