Mathematial C functions

0th

Percentile

Transformation of coordinate systems

The functions provide mathematical c functions as RMmodels

Keywords
models, spatial
Usage
RFcalc(model) R.minus(a, b, factor) R.plus(a, b, factor) R.div(a, b, factor) R.mult(a, b, factor) R.const(a) R.c(a, b, c, d, e, f, g, h, i, j, factor) R.p(proj, new, factor) R.is(a, is, b) R.lon() R.lat()
R.acos(a) asin(x) R.asin(a) atan(x) R.atan(a) atan2(y, x) R.atan2(a, b) cos(x) R.cos(a) sin(x) R.sin(a) tan(x) R.tan(a) acosh(x) R.acosh(a) asinh(x) R.asinh(a) atanh(x) R.atanh(a) cosh(x) R.cosh(a) sinh(x) R.sinh(a) tanh(x) R.tanh(a) exp(x) R.exp(a) log(x) R.log(a) expm1(x) R.expm1(a) log1p(x) R.log1p(a) logb(x) R.logb(a) R.exp2(a) log2(x) R.log2(a) R.pow(a, b) sqrt(x) R.sqrt(a) R.hypot(a, b) R.cbrt(a) R.ceil(a) abs(x) R.fabs(a) floor(x) R.floor(a) R.fmod(a, b) R.nearbyint(a) round(x, ...) R.round(a) trunc(x) R.trunc(a) R.lrint(a) R.llrint(a) R.lround(a) R.llround(a) R.copysign(a, b) R.erf(a) R.erfc(a) gamma(x) R.tgamma(a) lgamma(x) R.lgamma(a) R.rint(a) R.nextafter(a, b) R.nexttoward(a, b) R.remainder(a, b) R.fdim(a, b) max(...) R.fmax(a, b) min(...) R.fmin(a, b)
Arguments
model
object of class RMmodel, in particular R.model
x,y,a, b, c, d, e, f, g, h, i, j, ...
constant or object of class RMmodel, in particular R.model
is
one of "==", "!=", "<="< code="">, "<"< code="">, ">=", ">"
factor
constant factor multiplied with the function. This is useful when linear models are built
proj
selection of a component of the vector giving the location. Default value is 1.
new
coordinate system or other kind of isotropy which is supposed to be present at this model. It shold always be given if the coordinates are not cartesian.
Details

For the remaining models see the corresponding C functions for their return value. (For any ‘R.model’ type ‘man model’ under Linux.)

Value

Formally, the functions return an object of class RMmodel, except for RFcalc that returns a scalar. Neither vectors nor parentheses are allowed.

Note

The function RFcalc is intended for simple calculations only and it is not excessively tested. Especially, binary operators should be used with caution.

Note that all the functions here are NOT recognized as being positive definite (or negative definite), e.g. cos in $R^1$:

  1. please use the functions given in RMmodels for definite functions (for cos see RMbessel)
  2. Using uncapsulated substraction to build up a covariance function is ambiguous, see the example in RMtrend

See Also

RMmodel, RFfctn, RMtrend

Aliases
  • RFcalc
  • R.models
  • math.c
  • R.
  • R.plus
  • R.minus
  • -
  • R.mult
  • R.div
  • /
  • R.const
  • R.c
  • c
  • R.is
  • R.p
  • R.lon
  • R.lat
  • R.acos
  • R.asin
  • asin
  • R.atan
  • atan
  • R.atan2
  • atan2
  • R.cos
  • cos
  • R.sin
  • sin
  • R.tan
  • tan
  • R.acosh
  • acosh
  • R.asinh
  • asinh
  • R.atanh
  • atanh
  • R.cosh
  • cosh
  • R.sinh
  • sinh
  • R.tanh
  • tanh
  • R.exp
  • exp
  • R.log
  • log
  • R.expm1
  • expm1
  • R.log1p
  • log1p
  • R.logb
  • logb
  • R.exp2
  • R.log2
  • log2
  • R.pow
  • R.sqrt
  • sqrt
  • R.hypot
  • R.cbrt
  • R.ceil
  • R.fabs
  • abs
  • R.floor
  • floor
  • R.fmod
  • R.nearbyint
  • R.round
  • round
  • R.trunc
  • trunc
  • R.lrint
  • R.llrint
  • R.lround
  • R.llround
  • R.copysign
  • R.erf
  • R.erfc
  • R.tgamma
  • gamma
  • R.lgamma
  • lgamma
  • R.rint
  • R.nextafter
  • R.nexttoward
  • R.remainder
  • R.fdim
  • R.fmax
  • max
  • R.fmin
  • min
Examples
RFoptions(seed=0) ## *ANY* simulation will have the random seed 0; set
##                   RFoptions(seed=NA) to make them all random again

## simple calculation
RFcalc(3 + R.sin(pi/4))

## calculation performed on a field
RFfctn(R.p(1) + R.p(2), 1:3, 1:3) 
RFfctn(10 + R.p(2), 1:3, 1:3) 

## calculate the distances between two vectors
print(RFfctn(R.p(new="iso"), 1:10, 1:10))

## simulation of a non-stationary field where
## anisotropy by a transform the coordinates (x_1^2, x_2^1.5)
x <- seq(0.1, 6, 0.12)
Aniso <- R.c(R.p(1)^2, R.p(2)^1.5)
z <- RFsimulate(RMexp(Aniso=Aniso), x, x)


## calculating norms can be abbreviated:
x <- seq(-5, 5, 5) #0.1)
z2 <- RFsimulate(RMexp() + -40 + exp(0.5 * R.p(new="isotropic")), x, x)
z1 <- RFsimulate(RMexp() + -40 + exp(0.5 * sqrt(R.p(1)^2 + R.p(2)^2)), x, x)
stopifnot(all.equal(z1, z2))
plot(z1)




Documentation reproduced from package RandomFields, version 3.1.36, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.