Description Usage Arguments Value See Also Examples
nint_tanTransform
creates the transformation g(x) = atan((x - center)/scale)
to be used in nint_transform
.
1 | 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
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.