| DiscretizedFunction | R Documentation |
A simple fast tool for defining a discretized function defined continuously on [a,b] and discrete values in X, with equidistant data values y in between. The resulting function is vectorized and interpolates linearily with errors or NA outside the region. It handles infinite supports, but not infinite results on the continuous region.
DiscretizedFunction(y, ...)
## S3 method for class 'numeric'
DiscretizedFunction(y, ..., support = Support(...), transferCdf = NULL)
## S3 method for class ''function''
DiscretizedFunction(
y,
a = 0,
b = a,
n = 501,
X = c(),
transferCdf = NULL,
transferQf = cdf2qf(transferCdf, ...),
...
)
## S3 method for class 'Discretizer'
DiscretizedFunction(y, Y, ...)
## S3 method for class 'ReferenceMeasureTransformed'
DiscretizedFunction(y, f, n = 513, support = getSupport(y), ...)
## S3 method for class 'ReferenceMeasureUniform'
DiscretizedFunction(y, f, n = 513, support = getSupport(y), ...)
y |
the function to be approximated, or evaluation values, first those for X and than those equidistantly spaced xmin and xmax (in the image of transferCdf), or ReferenceMeasure on which to define the function (in this case the function is reported is given in f) |
... |
further arguments for Support (a,b,X) |
support |
the [Support] on which the function shall be defined. |
transferCdf |
a transfer function mapping the interval a,b to [0,1] (or another interval), in which the nots are place equidistantly and are interpolated linearily. |
a |
the lower limit of the domain |
b |
the upper limit of the domain |
n |
the number of discretization points on [a,b] |
X |
the discrete elements of the support (i.e. positions, where the function may jump. |
transferQf |
(qunantile function), must be the inverse of transferCdf and is used to determine the evaluation points for the function. |
Y |
replaces y, if y is a Discretizer |
f |
the function to be approximated (only if y is a ReferenceMeasure) |
a function interpolating linearly between the given evaluation points and working in a vectorized form.
DiscretizedFunction(numeric): method for precomputed values
DiscretizedFunction(`function`): method for functions that need to
be computed first.
DiscretizedFunction(Discretizer): method for Discretizer
DiscretizedFunction(ReferenceMeasureTransformed): method for functions on Transformed
Reference measures.
DiscretizedFunction(ReferenceMeasureUniform): method for functions on Transformed
Reference measures.
x=seq(0,1,length.out=100)
f = DiscretizedFunction(sin(x),0,1)
x=seq(0,1,length.out=1000)
max(abs(f(x)-sin(x)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.