create_derivative2nd_map: Create a mapping from function values to second derivatives

View source: R/map_derivative2nd.R

create_derivative2nd_mapR Documentation

Create a mapping from function values to second derivatives

Description

Create a mapping from a discretized version of a function given on a mesh of x-values to a finite-difference approximation of the second derivative evaluated at a subset of the source x-mesh.

Usage

create_derivative2nd_map()

Details

The following fields are required in the parameter list to initialize the mapping:

mapname Name of the mapping
maptype Must be "derivative2nd_map"
src_idx Vector of source indices
tar_idx Vector of target indices.
src_x Vector of x-values of the source mesh
tar_x Vector of x-values of the target mesh. Must be a subset of the x-values of the source mesh and must not include the lowest or largest x-value of the source mesh.
\loadmathjax

Let \mjseqnx_i denote the x-values of the mesh and \mjseqny_i the associated y-vales of the function. A finite-difference approximation of the first derivative is given by \mjsdeqn \Delta_i = \frac\vecy_i+1 - \vecy_i\vecx_i+1-\vecx_i Applying this equation recursively, we obtain a finite approximation to the second derivative: \mjsdeqn \Delta^2_i = \fracy_i-1(x_i-x_i-1)(x_i+1-x_i) + \fracy_i+1(x_i+1-x_i) (x_i+1-x_i) -\left( \frac1(x_i-x_i-1)(x_i+1-x_i) + \frac1(x_i+1-x_i) (x_i+1-x_i) \right) y_i

Value

Returns a list of functions to operate with the mapping, see create_maptype_map.

See Also

Other mappings: create_compound_map(), create_convolution_with_xtrafo_map(), create_derivative_map(), create_linearinterpol_map(), create_linearinterpol_with_xtrafo_map(), create_linearmap_map(), create_maptype_map(), create_map(), create_nonlinear_map(), create_normerr_map(), create_product_map()

Examples

params <- list(
  mapname = "myderiv2ndmap",
  maptype = "derivative2nd_map",
  src_idx = 1:5,
  tar_idx = 6:8,
  src_x = 1:5,
  tar_x = 2:4
)
mymap <- create_derivative2nd_map()
mymap$setup(params)
x <- c(1,3,2,4,5,0,0,0)
mymap$propagate(x)
mymap$jacobian(x)


gschnabel/nucdataBaynet documentation built on Feb. 3, 2023, 4:13 a.m.