nint_tanTransform {docopulae} | R Documentation |
nint_tanTransform
creates the transformation g(x) = atan((x - center)/scale)
to be used in nint_transform
.
nint_tanTransform(center, scale, dIdcs = NULL)
center, scale |
see |
dIdcs |
an integer vector of indices, the dimensions to transform. |
nint_tanTransform
returns a named list of two functions "g"
and "giDgi"
as required by nint_transform
.
mu = 1e0 sigma = mu/3 f = function(x) dnorm(x, mean=mu, sd=sigma) space = nint_space(nint_intvDim(-Inf, Inf)) tt = nint_transform(f, space, list(nint_tanTransform(0, 1, dIdcs=1))) tt$space ff = Vectorize(tt$f); curve(ff(x), tt$space[[1]][1], tt$space[[1]][2]) nint_integrate(tt$f, tt$space) # should return 1 # same with larger mu mu = 1e4 sigma = mu/3 f = function(x) dnorm(x, mean=mu, sd=sigma) tt = nint_transform(f, space, list(nint_tanTransform(0, 1, dIdcs=1))) ff = Vectorize(tt$f); curve(ff(x), tt$space[[1]][1], tt$space[[1]][2]) try(nint_integrate(tt$f, tt$space)) # integral is probably divergent # same with different transformation tt = nint_transform(f, space, list(nint_tanTransform(mu, sigma, dIdcs=1))) ff = Vectorize(tt$f); curve(ff(x), tt$space[[1]][1], tt$space[[1]][2]) nint_integrate(tt$f, tt$space) # should return 1