# How to perfom numerical integration over not closed forms

by LFRC   Last Updated April 22, 2017 19:19 PM

I want to integrate the following function:

$\int_{W}\eta^{1-B(u)}du$, where $\eta$ is a constant, $W$ corresponds to the observation window for the point process and

$B(u)=\frac{A_{w}(\textbf{x})-A_{w}(\textbf\{x\} \setminus \{u\}) }{\pi r^2}$

$A$ represents the area of a point pattern $\textbf{x}$ on $W$, $\eta$ is a constant and $u$ is a point on $W$

This is a cartoon of the thing:

I am trying to do this using the package polyCub from R, but is not working, I appreciate any help

My attempt:

source("figurelayout.R")
source("startup.R")
library(spatstat)

requireversion(spatstat, "1.41-1.073")

W <- as.owin(swedishpines)
x <- c(28,29,55,60,66)
#xp<-seq(W\$xrange[1],)
y <- c(70,38,32,72,59)
X <- ppp(x=x,y=y, window = W)
u <- list(x=48,y=50)
u <- as.ppp(u, W)
ovlap <- intersect.owin(uplusr, Xplusr)
AIdemo <- layered(W,
ovlap,
Xplusr,
uplusr,
X,
u)
layerplotargs(AIdemo) <- list(list(),
list(col="darkgrey", border=NA),
list(lwd=2),
list(lwd=2, lty=2),
list(pch=16),
list(pch=3))
newplot(6, 0.7)
setmargins(0)

plot(AIdemo, main="")

library(polyCub)