QMath: Transformation of coordinate systems

Description Usage Arguments Details Value Note See Also Examples

Description

The functions provide mathematical c functions as RMmodels

Usage

  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
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
RFcalc(model, params, ...)
R.minus(x, y, factor)
R.plus(x, y, factor)
R.div(x, y, factor)
R.mult(x, y, factor)
R.const(x)
R.c(a, b, c, d, e, f, g, h, i, j, l, m, n, o, p, q, ncol, factor)
R.p(proj, new, factor)
R.is(x, is, y)
R.lon()
R.lat()

R.gamma(x)
R.acos(x)
R.asin(x)
R.atan(x)
R.atan2(y, x)
R.cos(x)
R.sin(x)
R.tan(x)
R.acosh(x)
R.asinh(x)
R.atanh(x)
R.cosh(x)
R.sinh(x)
R.tanh(x)
R.exp(x)
R.log(x)
R.expm1(x)
R.log1p(x)
R.exp2(x)
R.log2(x)
R.pow(x, y)
R.sqrt(x)
R.hypot(x, y)
R.cbrt(x)
R.ceil(x)
R.fabs(x)
R.floor(x)
R.fmod(x, y)
R.round(x)
R.trunc(x)
R.erf(x)
R.erfc(x)
R.lgamma(x)
R.remainder(x, y)
R.fdim(x, y)
R.fmax(x, y)
R.fmin(x, y)

## S4 method for signature 'ANY,RMmodel'
e1 %% e2
## S4 method for signature 'RMmodel,ANY'
e1 %% e2
## S4 method for signature 'RMmodel,character'
e1 * e2
## S4 method for signature 'character,RMmodel'
e1 * e2
## S4 method for signature 'RMmodel,character'
e1 + e2
## S4 method for signature 'RMmodel,factor'
e1 + e2
## S4 method for signature 'RMmodel,list'
e1 + e2
## S4 method for signature 'character,RMmodel'
e1 + e2
## S4 method for signature 'data.frame,RMmodel'
e1 + e2
## S4 method for signature 'factor,RMmodel'
e1 + e2
## S4 method for signature 'RMmodel,character'
e1 - e2
## S4 method for signature 'character,RMmodel'
e1 - e2
## S4 method for signature 'RMmodel,character'
e1 / e2
## S4 method for signature 'character,RMmodel'
e1 / e2
## S4 method for signature 'ANY,RMmodel'
e1 ^ e2
## S4 method for signature 'RMmodel,ANY'
e1 ^ e2
## S4 method for signature 'RMmodel,character'
e1 ^ e2
## S4 method for signature 'character,RMmodel'
e1 ^ e2
## S4 method for signature 'RMmodel'
abs(x)
## S4 method for signature 'RMmodel'
acosh(x)
## S4 method for signature 'RMmodel'
asin(x)
## S4 method for signature 'RMmodel'
asinh(x)
## S4 method for signature 'ANY,RMmodel'
atan2(y,x)
## S4 method for signature 'RMmodel,ANY'
atan2(y,x)
## S4 method for signature 'RMmodel'
atan(x)
## S4 method for signature 'RMmodel'
atanh(x)
## S4 method for signature 'RMmodel'
ceiling(x)
## S4 method for signature 'RMmodel'
cos(x)
## S4 method for signature 'RMmodel'
cosh(x)
## S4 method for signature 'RMmodel'
exp(x)
## S4 method for signature 'RMmodel'
expm1(x)
## S4 method for signature 'RMmodel'
floor(x)
## S4 method for signature 'RMmodel'
lgamma(x)
## S4 method for signature 'RMmodel'
log1p(x)
## S4 method for signature 'RMmodel'
log2(x)
## S4 method for signature 'RMmodel'
log(x)
## S4 method for signature 'RMmodel,missing'
round(x,digits)
## S4 method for signature 'RMmodel'
sin(x)
## S4 method for signature 'RMmodel'
sinh(x)
## S4 method for signature 'RMmodel'
sqrt(x)
## S4 method for signature 'RMmodel'
tan(x)
## S4 method for signature 'RMmodel'
tanh(x)
## S4 method for signature 'RMmodel'
trunc(x)

Arguments

model,params \argModel

model is usually a R.model given here.

e1,e2,x,y,a, b, c, d, e, f, g, h, i, j, l, m, n, o, p, q

constant or object of class RMmodel, in particular R.model

ncol

in contrast to c, R.c also allows for defining matrices; ncol gives the number of columns

factor

constant factor multiplied with the function. This is useful when linear models are built

is

one of "==", "!=", "<=", "<", ">=", ">"

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.

digits

number of digits. Does not work with a RMmodel

... \argDots

Details

R.plus

adds two values

R.minus

substracts two values

R.mult

multiplies two values

R.div

devides two values

R.const

defines a constant

R.c

builds a vector

R.is

evaluates equalities and inequalities; note that TRUE is returned if the equality or inequality holds up to a tolerance given by RFoptions()$nugget$tol

R.p

takes a component out of the vector giving the location

R.lon, R.lat

longitudinal and latitudinal coordinate, given in the spherical system, i.e. in radians. (earth system is in degrees).

R.round

Note that R.round rounds away from zero.

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

Instead of R.model the standard function can be used in case there is no ambiguity, i.e., c(...),asin(x), atan(x), atan2(y, x), cos(x), sin(x), tan(x), acosh(x), asinh(x), atanh(x), cosh(x), sinh(x), tanh(x), exp(x), log(x), expm1(x), log2(x), log1p(x), exp2(x), ^, sqrt(x), hypot(a,b), cbrt(x), ceiling(x), abs(x), floor(x), round(x), trunc(x), erf(x), erfc(x), lgamma(x). See the examples below.

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

Examples

 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
27
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)

RandomFields documentation built on May 2, 2019, 4:51 a.m.