File: QMath.Rd

package info (click to toggle)
r-cran-randomfields 3.3.14-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,916 kB
  • sloc: cpp: 52,159; ansic: 3,015; makefile: 2; sh: 1
file content (384 lines) | stat: -rw-r--r-- 9,833 bytes parent folder | download | duplicates (2)
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
% This file has been created automatically by 'rfGenerateMaths'
\name{Mathematial C functions}
\alias{R.models}
\alias{RFcalc}
\alias{math.c}
\alias{R.}
\alias{R.plus}
%\alias{+}
\alias{R.minus}
\alias{-}
\alias{R.mult}
%\alias{*}
\alias{R.div}
\alias{/}
\alias{R.const}
\alias{R.c}
\alias{c}
\alias{R.is}
\alias{R.p}
\alias{R.lon}
\alias{R.lat}
\alias{R.gamma}
\alias{gamma}
\alias{R.acos}
\alias{R.asin}
\alias{asin}
\alias{R.atan}
\alias{atan}
\alias{R.atan2}
\alias{atan2}
\alias{R.cos}
\alias{cos}
\alias{R.sin}
\alias{sin}
\alias{R.tan}
\alias{tan}
\alias{R.acosh}
\alias{acosh}
\alias{R.asinh}
\alias{asinh}
\alias{R.atanh}
\alias{atanh}
\alias{R.cosh}
\alias{cosh}
\alias{R.sinh}
\alias{sinh}
\alias{R.tanh}
\alias{tanh}
\alias{R.exp}
\alias{exp}
\alias{R.log}
\alias{log}
\alias{R.expm1}
\alias{expm1}
\alias{R.log1p}
\alias{log1p}
\alias{R.exp2}
\alias{exp2}
\alias{R.log2}
\alias{log2}
\alias{R.pow}
\alias{^}
\alias{R.sqrt}
\alias{sqrt}
\alias{R.hypot}
\alias{hypot}
\alias{R.cbrt}
\alias{cbrt}
\alias{R.ceil}
\alias{ceiling}
\alias{R.fabs}
\alias{abs}
\alias{R.floor}
\alias{floor}
\alias{R.fmod}
\alias{\%\%}
\alias{R.round}
\alias{round}
\alias{R.trunc}
\alias{trunc}
\alias{R.erf}
\alias{erf}
\alias{R.erfc}
\alias{erfc}
\alias{R.lgamma}
\alias{lgamma}
\alias{R.nextafter}
\alias{R.nexttoward}
\alias{R.remainder}
\alias{R.ilogb}
\alias{R.fdim}
\alias{R.fmax}
\alias{max}
\alias{R.fmin}
\alias{min}
%\alias{R.nearbyint}
%\alias{R.logb}
%\alias{R.lrint}
%\alias{R.llrint}
%\alias{R.lround}
%\alias{R.llround}
%\alias{R.copysign}
%\alias{R.tgamma}
%\alias{R.rint}
\alias{\%\%,ANY,RMmodel-method}
\alias{\%\%,RMmodel,ANY-method}
\alias{*,RMmodel,character-method}
\alias{*,character,RMmodel-method}
\alias{+,RMmodel,character-method}
\alias{+,RMmodel,factor-method}
\alias{+,RMmodel,list-method}
\alias{+,character,RMmodel-method}
\alias{+,data.frame,RMmodel-method}
\alias{+,factor,RMmodel-method}
\alias{-,RMmodel,character-method}
\alias{-,character,RMmodel-method}
\alias{/,RMmodel,character-method}
\alias{/,character,RMmodel-method}
\alias{^,ANY,RMmodel-method}
\alias{^,RMmodel,ANY-method}
\alias{^,RMmodel,character-method}
\alias{^,character,RMmodel-method}
\alias{abs,RMmodel-method}
\alias{acosh,RMmodel-method}
\alias{asin,RMmodel-method}
\alias{asinh,RMmodel-method}
\alias{atan2,ANY,RMmodel-method}
\alias{atan2,RMmodel,ANY-method}
\alias{atan,RMmodel-method}
\alias{atanh,RMmodel-method}
\alias{ceiling,RMmodel-method}
\alias{cos,RMmodel-method}
\alias{cosh,RMmodel-method}
\alias{exp,RMmodel-method}
\alias{expm1,RMmodel-method}
\alias{floor,RMmodel-method}
\alias{lgamma,RMmodel-method}
\alias{log1p,RMmodel-method}
\alias{log2,RMmodel-method}
\alias{log,RMmodel-method}
\alias{round,RMmodel,missing-method}
\alias{sin,RMmodel-method}
\alias{sinh,RMmodel-method}
\alias{sqrt,RMmodel-method}
\alias{tan,RMmodel-method}
\alias{tanh,RMmodel-method}
\alias{trunc,RMmodel-method}
\title{Transformation of coordinate systems}
\description{
  The functions provide mathematical c functions as \link{RMmodels}
}
 
\usage{
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()
%c(...)
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)

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


\arguments{
  \item{model,params}{\argModel
    \code{model} is usually a \command{R.model} given here.}
  \item{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
    \code{\link[=RMmodel-class]{RMmodel}}, in particular
    \command{R.model}}
  \item{ncol}{in contrast to \link[base]{c}, \command{R.c} also allows for
   defining matrices; \code{ncol} gives the number of columns}
  \item{factor}{constant factor multiplied with the function. This is
    useful when linear models are built}
  \item{is}{one of \code{"=="}, \code{"!="}, \code{"<="}, \code{"<"},
    \code{">="}, \code{">"}} 
   \item{proj}{selection of a component of the vector giving the
    location. Default value is 1.}
  \item{new}{\link{coordinate system} or other 
    \code{\link[=RC_ISO_NAMES]{kind of isotropy}}
    which is supposed to be present at this model.
    It shold always be given if the coordinates are not cartesian.
  }
  \item{digits}{number of digits. Does not work with a \link{RMmodel}}
  \item{...}{\argDots}
%  \item{\code{signature(x = "RMmodel")}}{an \link{RMmodel}, especially a
%  function from this man page. }
%  \item{\code{signature(x = "ANY")}}{numeric or  RMmodel }
% \item{\code{signature(x = "character")}}{no characters allowed. }
}
    
\details{
  \describe{ 
  \item{R.plus}{adds two values}
  \item{R.minus}{substracts two values}
  \item{R.mult}{multiplies two values}
  \item{R.div}{devides two values}
  \item{R.const}{defines a constant }
  \item{R.c}{builds a vector}
  \item{R.is}{evaluates equalities and inequalities;
	note that \code{TRUE} is returned if the equality or
	 inequality holds up to a tolerance given by 
	\code{\link{RFoptions}()$nugget$tol}}
  \item{R.p}{takes a component out of the vector giving the location}
  \item{R.lon, R.lat}{longitudinal and latitudinal coordinate, given
        in the \emph{spherical system}, i.e. in radians.
        (earth system is in degrees).}
  \item{R.round}{Note that \command{R.round} rounds away from zero.
  }
  }
  For the remaining models see the corresponding C functions for
  their return value. 
  (For any \sQuote{R.model} type \sQuote{man model} under Linux.)
}

\value{
Formally, the functions return an object of class
\code{\link[=RMmodel-class]{RMmodel}}, except for
\command{RFcalc} that returns a scalar.
Neither vectors nor parentheses are allowed.
}
%\references{}
  
\note{
  Instead of \code{R.model} the standard function can be used in case
  there is no ambiguity, i.e.,
\code{c(...)},\code{asin(x)}, \code{atan(x)}, \code{atan2(y, x)}, \code{cos(x)},
  \code{sin(x)}, \code{tan(x)}, \code{acosh(x)}, \code{asinh(x)},
  \code{atanh(x)}, \code{cosh(x)}, \code{sinh(x)}, \code{tanh(x)},
  \code{exp(x)}, \code{log(x)}, \code{expm1(x)}, \code{log2(x)},
  \code{log1p(x)}, \code{exp2(x)}, \code{^}, \code{sqrt(x)},
  \code{hypot(a,b)}, \code{cbrt(x)}, \code{ceiling(x)}, \code{abs(x)},
  \code{floor(x)}, \code{round(x)}, \code{trunc(x)},
  \code{erf(x)}, \code{ erfc(x)}, \code{lgamma(x)}. See the examples
  below. 

  
The function \command{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. \command{cos} in
\eqn{R^1}:
\enumerate{
  \item please use the functions given in \command{\link{RMmodels}}
       for definite functions (for \code{cos} see \command{\link{RMbessel}})
  \item Using uncapsulated substraction to build up a covariance
	function is ambiguous, see the example in \command{\link{RMtrend}}
      }      
}


\me
\seealso{
 \command{\link{RMmodel}}, \command{\link{RFfctn}},
	 \command{\link{RMtrend}}	
}

\examples{\dontshow{StartExample()}
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)



\dontshow{FinalizeExample()}}


\keyword{spatial}
\keyword{models}