1664946660

# A Julia Implementation Of Barycentric interpolation

## BarycentricInterpolation

This Julia package implements the Barycentric formula for polynomial interpolation on equispaced points and Chebyshev points of the first and second kind. The formulae used are taken from the paper of Berrut and Trefethen, SIAM Review, 2004.

This is not a general purpose interpolation package but is intended to be used as a base for other numerical methods, such as numerical collocation. For a general use interpolation package see Interpolations.jl

## Usage

There are various types of polynomials defined based on the locations of their nodes (zeros).

• Equispaced (`Equispaced{N}()`) — a common choice when data is equispaced but suffers from Runge phenomenon for high degree polynomials. When used as part of a collocation scheme with Gauss-Legendre collocation points, they provide the benefit of super-convergence. By default the nodes are equispaced over [-1, +1].
• Chebyshev type 1 (`Chebyshev1{N}()`) — nodes distributed according to cos(π(2j + 1)/(2N + 2)) where N is the degree of the polynomial, for j in [0, N].
• Chebyshev type 2 (`Chebyshev2{N}()`) — nodes distributed according to cos(πj/N) where N is the degree of the polynomial, for j in [0, N].
• Legendre (`Legendre{N}()`) — nodes distributed according to the zeros of the corresponding Legendre polynomial where N is the degree of the polynomial.
• Arbitrary nodes (`ArbitraryPolynomial(nodes)`) — nodes distributed as specified.

By default, each of the polynomials are defined over the range [-1, +1]. This can be modified by specifying a start and stop for the range, e.g., `Equispaced{10}(0, 1)` will generate a 10th order polynomial with equispaced nodes over the range [0, 1].

Polynomials with nodes asymptotically clustered towards the end points (such as Chebyshev) are optimal for avoiding the Runge phenomenon (see Trefethen, Spectral Methods in MATLAB, SIAM 2000).

Once a polynomial has been defined it can be used with the `nodes(poly)` and `weights(poly)` functions to return the locations of the nodes and the values of the Barycentric weights respectively. To interpolate a set of `y` values (defined at the nodes) use `interpolate(poly, y, x_new)`; `x_new` can be either a scalar or a vector. If `x_new` is omitted, the `interpolate` function returns a function `y(x)` which can be used to evaluate the interpolant at any point.

To obtain the interpolant as a linear combination of the `y` values, use `interpolation_matrix(poly, x)`; this returns a matrix which can be multiplied by a vector of `y` values to calculate the interpolated value.

Finally, the derivative of the polynomial at the nodes can be obtained using `differentiation_matrix(poly)`. Similar to `interpolation_matrix`, this returns a matrix which can be multiplied by a vector of `y` values to calculate the derivative of `y`.

## Simple example

``````using BarycentricInterpolation

p = Chebyshev2{20}()           # create a Chebyshev type 2 polynomial of order 20
x = nodes(p)                   # get the nodes
y = sinpi.(x)                  # generate y values at the nodes
x_new = rand()*2 -1            # a random number in [-1, +1]
println(interpolate(p, y, x_new) ≈ sinpi(x_new))       # hopefully true!
D = differentiation_matrix(p)  # get the differentiation matrix
println(interpolate(p, D*y, x_new) ≈ pi*cospi(x_new))  # hopefully true!
``````

## More complicated example

For an example with Barycentric.jl applied to the simulation of a PDE (in combination with DifferentialEquations.jl) see https://cityinthesky.co.uk/posts/2018/barycentricinterpolation.jl/.

Author: Dawbarton
Source Code: https://github.com/dawbarton/BarycentricInterpolation.jl

1664946660

## BarycentricInterpolation

This Julia package implements the Barycentric formula for polynomial interpolation on equispaced points and Chebyshev points of the first and second kind. The formulae used are taken from the paper of Berrut and Trefethen, SIAM Review, 2004.

This is not a general purpose interpolation package but is intended to be used as a base for other numerical methods, such as numerical collocation. For a general use interpolation package see Interpolations.jl

## Usage

There are various types of polynomials defined based on the locations of their nodes (zeros).

• Equispaced (`Equispaced{N}()`) — a common choice when data is equispaced but suffers from Runge phenomenon for high degree polynomials. When used as part of a collocation scheme with Gauss-Legendre collocation points, they provide the benefit of super-convergence. By default the nodes are equispaced over [-1, +1].
• Chebyshev type 1 (`Chebyshev1{N}()`) — nodes distributed according to cos(π(2j + 1)/(2N + 2)) where N is the degree of the polynomial, for j in [0, N].
• Chebyshev type 2 (`Chebyshev2{N}()`) — nodes distributed according to cos(πj/N) where N is the degree of the polynomial, for j in [0, N].
• Legendre (`Legendre{N}()`) — nodes distributed according to the zeros of the corresponding Legendre polynomial where N is the degree of the polynomial.
• Arbitrary nodes (`ArbitraryPolynomial(nodes)`) — nodes distributed as specified.

By default, each of the polynomials are defined over the range [-1, +1]. This can be modified by specifying a start and stop for the range, e.g., `Equispaced{10}(0, 1)` will generate a 10th order polynomial with equispaced nodes over the range [0, 1].

Polynomials with nodes asymptotically clustered towards the end points (such as Chebyshev) are optimal for avoiding the Runge phenomenon (see Trefethen, Spectral Methods in MATLAB, SIAM 2000).

Once a polynomial has been defined it can be used with the `nodes(poly)` and `weights(poly)` functions to return the locations of the nodes and the values of the Barycentric weights respectively. To interpolate a set of `y` values (defined at the nodes) use `interpolate(poly, y, x_new)`; `x_new` can be either a scalar or a vector. If `x_new` is omitted, the `interpolate` function returns a function `y(x)` which can be used to evaluate the interpolant at any point.

To obtain the interpolant as a linear combination of the `y` values, use `interpolation_matrix(poly, x)`; this returns a matrix which can be multiplied by a vector of `y` values to calculate the interpolated value.

Finally, the derivative of the polynomial at the nodes can be obtained using `differentiation_matrix(poly)`. Similar to `interpolation_matrix`, this returns a matrix which can be multiplied by a vector of `y` values to calculate the derivative of `y`.

## Simple example

``````using BarycentricInterpolation

p = Chebyshev2{20}()           # create a Chebyshev type 2 polynomial of order 20
x = nodes(p)                   # get the nodes
y = sinpi.(x)                  # generate y values at the nodes
x_new = rand()*2 -1            # a random number in [-1, +1]
println(interpolate(p, y, x_new) ≈ sinpi(x_new))       # hopefully true!
D = differentiation_matrix(p)  # get the differentiation matrix
println(interpolate(p, D*y, x_new) ≈ pi*cospi(x_new))  # hopefully true!
``````

## More complicated example

For an example with Barycentric.jl applied to the simulation of a PDE (in combination with DifferentialEquations.jl) see https://cityinthesky.co.uk/posts/2018/barycentricinterpolation.jl/.

Author: Dawbarton
Source Code: https://github.com/dawbarton/BarycentricInterpolation.jl

1666125240

## InterPol.jl: Interpolating polynomial for Julia

InterPol

Given values of a function y=y(x) `y=[...]` at points `x=[...]` we can generate an interpolating polynomial p(x). This package provides two functions: `interpolateAt` and `interpolateDerivativeAt`. `interpolateAt[x,y,x0]` gives the value of the interpolating polynomial p at the point x0. `interpolateDerivativeAt[x,y,x0]` evaluates p' at the point x0. For example

``````julia> interpolateAt([0,1,2],[0,1,4],1)
1.0
julia> interpolateDerivativeAt([0,1,2],[0,1,4],1)
2.0
``````

Author: pwl
Source Code: https://github.com/pwl/InterPol.jl

1664942580

## ApproXD

• This package implements bspline and linear interpolation in julia
• For most purposes, Interpolations.jl will be preferrable to this package.
• However, there are some features which are available here, and not there.
• the method `getTensorCoef` is a very efficient algorithm to compute approximating coefficients from a tensor product of basis matrices. it is efficient because it never forms the tensor product.
• the package allows low-level access to objects such as spline knot vectors. Suppose you want to have a knot vector with a knot multiplicity in the interior knot span to approximate a kink. For example,
``knots = vcat(lb,-0.5,0,0,0.5,ub)``

is a valid knot vector.

• Documentation is non-existent. Please look at the tests. Sorry.

## Example

``````using ApproXD
f(x) = abs.(x).^0.5
lb,ub = (-1.0,1.0)
nknots = 13
deg = 3

# standard case: equally spaced knots
params1 = BSpline(nknots,deg,lb,ub)
nevals = 5 * params1.numKnots # get nBasis < nEvalpoints

# myknots with knot multiplicity at 0
myknots = vcat(range(-1,stop = -0.1,length = 5),0,0,0,  range(0.1,stop = 1,length =5))
params2 = BSpline(myknots,deg)  # 0: no derivative

# get coefficients for each case
eval_points = collect(range(lb,stop = ub,length = nevals))
c1 = getBasis(eval_points,params1) \ f(eval_points)
c2 = getBasis(eval_points,params2) \ f(eval_points)

# look at errors over entire interval
test_points = collect(range(lb,stop = ub,length = 1000));
truth = f(test_points);
p1 = getBasis(test_points,params1) * c1;
p2 = getBasis(test_points,params2) * c2;
e1 = p1 - truth;
e2 = p2 - truth;``````

Author: floswald
Source Code: https://github.com/floswald/ApproXD.jl

1660615380

## Arrow

This is a pure Julia implementation of the Apache Arrow data standard. This package provides Julia `AbstractVector` objects for referencing data that conforms to the Arrow standard. This allows users to seamlessly interface Arrow formatted data with a great deal of existing Julia code.

## Installation

The package can be installed by typing in the following in a Julia REPL:

``````julia> using Pkg; Pkg.add("Arrow")
``````

or to use the official-apache code that follows the official apache release process, you can do:

``````julia> using Pkg; Pkg.add(url="https://github.com/apache/arrow", subdir="julia/Arrow.jl")
``````

## Local Development

When developing on Arrow.jl it is recommended that you run the following to ensure that any changes to ArrowTypes.jl are immediately available to Arrow.jl without requiring a release:

``````julia --project -e 'using Pkg; Pkg.develop(path="src/ArrowTypes")'
``````

## Format Support

This implementation supports the 1.0 version of the specification, including support for:

• All primitive data types
• All nested data types
• Dictionary encodings and messages
• Extension types
• Streaming, file, record batch, and replacement and isdelta dictionary messages

It currently doesn't include support for:

• Tensors or sparse tensors
• Flight RPC
• C data interface

Third-party data formats:

See the full documentation for details on reading and writing arrow data.

Please see this document for a description of the Arrow memory layout.

Author: Apach
Source Code: https://github.com/apache/arrow-julia

1631267007

## DataStructures.jl

This package implements a variety of data structures, including

• Deque (implemented with an unrolled linked list)
• CircularBuffer
• CircularDeque (based on a circular buffer)
• Stack
• Queue
• Priority Queue
• Fenwick Tree
• Accumulators and Counters (i.e. Multisets / Bags)
• Disjoint-Set
• Binary Heap
• Mutable Binary Heap
• Ordered Dicts and Sets
• RobinDict (implemented with Robin Hood Hashing)
• SwissDict (inspired from SwissTables)
• Dictionaries with Defaults
• Trie
• Sorted Dict, Sorted Multi-Dict and Sorted Set
• DataStructures.IntSet
• SparseIntSet
• DiBitVector (in which each element can store two bits)
• Red Black Tree
• AVL Tree
• Splay Tree

Author: JuliaCollections
The Demo/Documentation: View The Demo/Documentation
Official Website: https://github.com/JuliaCollections/DataStructures.jl