::tclinterp::interpolation

Commands

cubicSpline1d

Performs piecewise cubic spline interpolation.

cubicSpline1d -t values -y values -ti values ?-ibcbeg condition? ?-ibcend condition? ?-ybcbeg value? ?-ybcend value? ?-deriv? ?-input list|vector? ?-output list|vector? ?-name name? ?-names dictionary? ?-ifexists error|replace?

Parameters

-deriv:

Include first and second derivatives in the result dictionary.

-ibcbeg condition:

Left boundary condition: quad, der1, der2, or notaknot; defaults to quad. Alias: -begflag.

-ibcend condition:

Right boundary condition: quad, der1, der2, or notaknot; defaults to quad. Alias: -endflag.

-ifexists error|replace:

Policy for existing destination vectors; defaults to error. With replace, an existing real vector is resized and overwritten.

-input list|vector:

Input representation for all array arguments: Tcl lists or real RBC vector names. Defaults to list.

-name name:

Destination vector name for yi; requires -output vector. Omit it or use #auto to create an automatically named vector.

-names dictionary:

Dictionary mapping output fields to destination vector names; requires -output vector. Valid fields: yi and, only with -deriv, yder1, yder2.

-output list|vector:

Output representation for every numeric result array: Tcl list or RBC vector name. Defaults to list; independent of -input.

-t values:

Strictly increasing sample positions; at least two values. Alias: -x.

-ti values:

Evaluation positions; must not be empty. Alias: -xi.

-y values:

Sample values; must have the same length as -t.

-ybcbeg value:

Prescribed left endpoint derivative for der1 or der2; defaults to 0.0.

-ybcend value:

Prescribed right endpoint derivative for der1 or der2; defaults to 0.0.

Description

Every array argument marked values uses the representation selected by -input. Scalar options remain ordinary Tcl numbers. Numeric inputs must be finite. RBC support must be enabled in the build to use vectors.

Vector names resolve in the caller’s namespace; destination namespaces must already exist. Each unnamed output, including fields omitted from -names, is created with ::rbc::vector create #auto. Returned vector names are fully qualified.

Do not specify both -name and the yi entry of -names. Unknown output fields and duplicate destinations are errors. The caller owns returned vectors and can release them with ::rbc::vector destroy $vectorName.

The boundary condition quad makes the first or last interval quadratic. The conditions der1 and der2 prescribe the first or second endpoint derivative using -ybcbeg or -ybcend, respectively for the left or right endpoint. The condition notaknot makes the third derivative continuous at the first or last interior knot and requires at least four samples.

Return value

The interpolated values yi. With -deriv, returns a dictionary with yi, first derivatives yder1, and second derivatives yder2. Each numeric array is a Tcl list by default or an RBC vector name with -output vector.

divDif1d

Performs divided-difference polynomial interpolation.

divDif1d -x values -y values -xi values ?-coeffs? ?-input list|vector? ?-output list|vector? ?-name name? ?-names dictionary? ?-ifexists error|replace?

Parameters

-coeffs:

Include the divided-difference coefficient array in the result dictionary.

-ifexists error|replace:

Policy for existing destination vectors; defaults to error. With replace, an existing real vector is resized and overwritten.

-input list|vector:

Input representation for all array arguments: Tcl lists or real RBC vector names. Defaults to list.

-name name:

Destination vector name for yi; requires -output vector. Omit it or use #auto to create an automatically named vector.

-names dictionary:

Dictionary mapping output fields to destination vector names; requires -output vector. Valid fields: yi and, only with -coeffs, coeffs.

-output list|vector:

Output representation for every numeric result array: Tcl list or RBC vector name. Defaults to list; independent of -input.

-x values:

Distinct sample positions; at least one value.

-xi values:

Evaluation positions; must not be empty.

-y values:

Sample values; must have the same length as -x.

Description

Every array argument marked values uses the representation selected by -input. Scalar options remain ordinary Tcl numbers. Numeric inputs must be finite. RBC support must be enabled in the build to use vectors.

Vector names resolve in the caller’s namespace; destination namespaces must already exist. Each unnamed output, including fields omitted from -names, is created with ::rbc::vector create #auto. Returned vector names are fully qualified.

Do not specify both -name and the yi entry of -names. Unknown output fields and duplicate destinations are errors. The caller owns returned vectors and can release them with ::rbc::vector destroy $vectorName.

Return value

The interpolated values yi. With -coeffs, returns a dictionary with yi and coeffs arrays. Each numeric array is a Tcl list by default or an RBC vector name with -output vector.

hermiteSpline1d

Performs cubic Hermite spline interpolation.

hermiteSpline1d -t values -y values -yp values -ti values ?-deriv? ?-input list|vector? ?-output list|vector? ?-name name? ?-names dictionary? ?-ifexists error|replace?

Parameters

-deriv:

Include first derivatives in the result dictionary.

-ifexists error|replace:

Policy for existing destination vectors; defaults to error. With replace, an existing real vector is resized and overwritten.

-input list|vector:

Input representation for all array arguments: Tcl lists or real RBC vector names. Defaults to list.

-name name:

Destination vector name for yi; requires -output vector. Omit it or use #auto to create an automatically named vector.

-names dictionary:

Dictionary mapping output fields to destination vector names; requires -output vector. Valid fields: yi and, only with -deriv, yder1.

-output list|vector:

Output representation for every numeric result array: Tcl list or RBC vector name. Defaults to list; independent of -input.

-t values:

Strictly increasing sample positions; at least two values. Alias: -x.

-ti values:

Evaluation positions; must not be empty. Alias: -xi.

-y values:

Sample values; must have the same length as -t.

-yp values:

First derivatives at the sample positions; same length as -t.

Description

Every array argument marked values uses the representation selected by -input. Scalar options remain ordinary Tcl numbers. Numeric inputs must be finite. RBC support must be enabled in the build to use vectors.

Vector names resolve in the caller’s namespace; destination namespaces must already exist. Each unnamed output, including fields omitted from -names, is created with ::rbc::vector create #auto. Returned vector names are fully qualified.

Do not specify both -name and the yi entry of -names. Unknown output fields and duplicate destinations are errors. The caller owns returned vectors and can release them with ::rbc::vector destroy $vectorName.

Return value

The interpolated values yi. With -deriv, returns a dictionary with yi and first derivatives yder1. Each numeric array is a Tcl list by default or an RBC vector name with -output vector.

lagr1d

Performs Lagrange polynomial one-dimensional interpolation.

lagr1d -x values -y values -xi values ?-input list|vector? ?-output list|vector? ?-name name? ?-names dictionary? ?-ifexists error|replace?

Parameters

-ifexists error|replace:

Policy for existing destination vectors; defaults to error. With replace, an existing real vector is resized and overwritten.

-input list|vector:

Input representation for all array arguments: Tcl lists or real RBC vector names. Defaults to list.

-name name:

Destination vector name for yi; requires -output vector. Omit it or use #auto to create an automatically named vector.

-names dictionary:

Dictionary mapping output fields to destination vector names; requires -output vector. Valid fields: yi.

-output list|vector:

Output representation for every numeric result array: Tcl list or RBC vector name. Defaults to list; independent of -input.

-x values:

Distinct sample positions; at least one value.

-xi values:

Evaluation positions; must not be empty.

-y values:

Sample values; must have the same length as -x.

Description

Every array argument marked values uses the representation selected by -input. Scalar options remain ordinary Tcl numbers. Numeric inputs must be finite. RBC support must be enabled in the build to use vectors.

Vector names resolve in the caller’s namespace; destination namespaces must already exist. Each unnamed output, including fields omitted from -names, is created with ::rbc::vector create #auto. Returned vector names are fully qualified.

Do not specify both -name and the yi entry of -names. Unknown output fields and duplicate destinations are errors. The caller owns returned vectors and can release them with ::rbc::vector destroy $vectorName.

Return value

The interpolated values yi, as a Tcl list by default or an RBC vector name with -output vector.

least1d

Fits a least-squares polynomial.

least1d -x values -y values -xi values ?-w values? ?-nterms integer? ?-coeffs? ?-input list|vector? ?-output list|vector? ?-name name? ?-names dictionary? ?-ifexists error|replace?

Parameters

-coeffs:

Include polynomial coefficient arrays in the result dictionary.

-ifexists error|replace:

Policy for existing destination vectors; defaults to error. With replace, an existing real vector is resized and overwritten.

-input list|vector:

Input representation for all array arguments: Tcl lists or real RBC vector names. Defaults to list.

-name name:

Destination vector name for yi; requires -output vector. Omit it or use #auto to create an automatically named vector.

-names dictionary:

Dictionary mapping output fields to destination vector names; requires -output vector. Valid fields: yi, and, only with -coeffs, coeffs.b, coeffs.c, coeffs.d.

-nterms integer:

Number of polynomial terms; defaults to 3. Must be positive and no greater than the number of distinct sample positions.

-output list|vector:

Output representation for every numeric result array: Tcl list or RBC vector name. Defaults to list; independent of -input.

-w values:

Optional positive weights; same length as -x. Defaults to all ones.

-x values:

Sample positions; at least one value.

-xi values:

Evaluation positions; must not be empty.

-y values:

Sample values; must have the same length as -x.

Description

Every array argument marked values uses the representation selected by -input. Scalar options remain ordinary Tcl numbers. Numeric inputs must be finite. RBC support must be enabled in the build to use vectors.

Vector names resolve in the caller’s namespace; destination namespaces must already exist. Each unnamed output, including fields omitted from -names, is created with ::rbc::vector create #auto. Returned vector names are fully qualified.

Do not specify both -name and the yi entry of -names. Unknown output fields and duplicate destinations are errors. The caller owns returned vectors and can release them with ::rbc::vector destroy $vectorName.

Return value

The fitted values yi, or a dictionary containing yi when -coeffs is specified. With -coeffs, the dictionary also contains coeffs, a nested dictionary with keys b, c, and d. Each numeric array is a Tcl list by default or an RBC vector name with -output vector.

least1dDer

Fits a least-squares polynomial and evaluates its first derivative.

least1dDer -x values -y values -xi values ?-w values? ?-nterms integer? ?-coeffs? ?-input list|vector? ?-output list|vector? ?-name name? ?-names dictionary? ?-ifexists error|replace?

Parameters

-coeffs:

Include polynomial coefficient arrays in the result dictionary.

-ifexists error|replace:

Policy for existing destination vectors; defaults to error. With replace, an existing real vector is resized and overwritten.

-input list|vector:

Input representation for all array arguments: Tcl lists or real RBC vector names. Defaults to list.

-name name:

Destination vector name for yi; requires -output vector. Omit it or use #auto to create an automatically named vector.

-names dictionary:

Dictionary mapping output fields to destination vector names; requires -output vector. Valid fields: yi, yiDer, and, only with -coeffs, coeffs.b, coeffs.c, coeffs.d.

-nterms integer:

Number of polynomial terms; defaults to 3. Must be positive and no greater than the number of distinct sample positions.

-output list|vector:

Output representation for every numeric result array: Tcl list or RBC vector name. Defaults to list; independent of -input.

-w values:

Optional positive weights; same length as -x. Defaults to all ones.

-x values:

Sample positions; at least one value.

-xi values:

Evaluation positions; must not be empty.

-y values:

Sample values; must have the same length as -x.

Description

Every array argument marked values uses the representation selected by -input. Scalar options remain ordinary Tcl numbers. Numeric inputs must be finite. RBC support must be enabled in the build to use vectors.

Vector names resolve in the caller’s namespace; destination namespaces must already exist. Each unnamed output, including fields omitted from -names, is created with ::rbc::vector create #auto. Returned vector names are fully qualified.

Do not specify both -name and the yi entry of -names. Unknown output fields and duplicate destinations are errors. The caller owns returned vectors and can release them with ::rbc::vector destroy $vectorName.

Return value

A dictionary with yi values and yiDer first derivatives. With -coeffs, the dictionary also contains coeffs, a nested dictionary with keys b, c, and d. Each numeric array is a Tcl list by default or an RBC vector name with -output vector.

lin1d

Performs linear one-dimensional interpolation.

lin1d -x values -y values -xi values ?-input list|vector? ?-output list|vector? ?-name name? ?-names dictionary? ?-ifexists error|replace?

Parameters

-ifexists error|replace:

Policy for existing destination vectors; defaults to error. With replace, an existing real vector is resized and overwritten.

-input list|vector:

Input representation for all array arguments: Tcl lists or real RBC vector names. Defaults to list.

-name name:

Destination vector name for yi; requires -output vector. Omit it or use #auto to create an automatically named vector.

-names dictionary:

Dictionary mapping output fields to destination vector names; requires -output vector. Valid fields: yi.

-output list|vector:

Output representation for every numeric result array: Tcl list or RBC vector name. Defaults to list; independent of -input.

-x values:

Strictly increasing sample positions; at least two values.

-xi values:

Evaluation positions; must not be empty.

-y values:

Sample values; must have the same length as -x.

Description

Every array argument marked values uses the representation selected by -input. Scalar options remain ordinary Tcl numbers. Numeric inputs must be finite. RBC support must be enabled in the build to use vectors.

Vector names resolve in the caller’s namespace; destination namespaces must already exist. Each unnamed output, including fields omitted from -names, is created with ::rbc::vector create #auto. Returned vector names are fully qualified.

Do not specify both -name and the yi entry of -names. Unknown output fields and duplicate destinations are errors. The caller owns returned vectors and can release them with ::rbc::vector destroy $vectorName.

Return value

The interpolated values yi, as a Tcl list by default or an RBC vector name with -output vector.

near1d

Performs nearest-neighbor one-dimensional interpolation.

near1d -x values -y values -xi values ?-input list|vector? ?-output list|vector? ?-name name? ?-names dictionary? ?-ifexists error|replace?

Parameters

-ifexists error|replace:

Policy for existing destination vectors; defaults to error. With replace, an existing real vector is resized and overwritten.

-input list|vector:

Input representation for all array arguments: Tcl lists or real RBC vector names. Defaults to list.

-name name:

Destination vector name for yi; requires -output vector. Omit it or use #auto to create an automatically named vector.

-names dictionary:

Dictionary mapping output fields to destination vector names; requires -output vector. Valid fields: yi.

-output list|vector:

Output representation for every numeric result array: Tcl list or RBC vector name. Defaults to list; independent of -input.

-x values:

Sample positions; at least one value.

-xi values:

Evaluation positions; must not be empty.

-y values:

Sample values; must have the same length as -x.

Description

Every array argument marked values uses the representation selected by -input. Scalar options remain ordinary Tcl numbers. Numeric inputs must be finite. RBC support must be enabled in the build to use vectors.

Vector names resolve in the caller’s namespace; destination namespaces must already exist. Each unnamed output, including fields omitted from -names, is created with ::rbc::vector create #auto. Returned vector names are fully qualified.

Do not specify both -name and the yi entry of -names. Unknown output fields and duplicate destinations are errors. The caller owns returned vectors and can release them with ::rbc::vector destroy $vectorName.

Return value

The interpolated values yi, as a Tcl list by default or an RBC vector name with -output vector.

pchip1d

Performs piecewise cubic Hermite interpolation (PCHIP).

pchip1d -x values -f values -xe values ?-input list|vector? ?-output list|vector? ?-name name? ?-names dictionary? ?-ifexists error|replace?

Parameters

-f values:

Sample values; same length as -x. Alias: -y.

-ifexists error|replace:

Policy for existing destination vectors; defaults to error. With replace, an existing real vector is resized and overwritten.

-input list|vector:

Input representation for all array arguments: Tcl lists or real RBC vector names. Defaults to list.

-name name:

Destination vector name for yi; requires -output vector. Omit it or use #auto to create an automatically named vector.

-names dictionary:

Dictionary mapping output fields to destination vector names; requires -output vector. Valid fields: yi.

-output list|vector:

Output representation for every numeric result array: Tcl list or RBC vector name. Defaults to list; independent of -input.

-x values:

Strictly increasing sample positions; at least two values.

-xe values:

Evaluation positions; must not be empty. Alias: -xi.

Description

Every array argument marked values uses the representation selected by -input. Scalar options remain ordinary Tcl numbers. Numeric inputs must be finite. RBC support must be enabled in the build to use vectors.

Vector names resolve in the caller’s namespace; destination namespaces must already exist. Each unnamed output, including fields omitted from -names, is created with ::rbc::vector create #auto. Returned vector names are fully qualified.

Do not specify both -name and the yi entry of -names. Unknown output fields and duplicate destinations are errors. The caller owns returned vectors and can release them with ::rbc::vector destroy $vectorName.

Return value

The interpolated values yi, as a Tcl list by default or an RBC vector name with -output vector.


Copyright (c) George Yashin