polywrapper {expandFunctions}R Documentation

Generate special functions using orthonormal functions

Description

orthopolynom can be used to generate special functions, but for expansion they should be modified. As of this writing, orthopolynom generates polynomials for Chebyshev, Hermite, Legendre and many other functions, their integrals and derivatives, and more.

Usage

polywrapper(basePoly = orthopolynom::chebyshev.t.polynomials, kMax = 0)

Arguments

basePoly

A polynomial list from orthopoly

kMax

Integer. The maximum order of the function generated.

Details

The function polywrapper does 2 things:

The functions so generated can be used as simple special functions, as well as being useful in feature building.

Since the coefficients from orthopolynom are generated by recursion, an upper limit of the function order needs to be set when calling polywrapper. This is the main limitation of polywrapper. Fortunately, since the functions are compactly stored, kMax can be set quite high if desired. Note that usually the kMax is known, and is relatively small.

NB: The input x may need to be normalized. orthopolynom has the function scaleX for just such a purpose.

Value

Function which is compatible with eOuter and eMatrixOuter

Examples

# Generate a Chebyshev function of the form
# chebyFUN(x,k), where x is the input and k is the order.
# In this case, k must be no more than 5 (since that
# is the value passed to kMax), although it is
# easy to set this to a higher order if desired.
chebyFUN <- polywrapper(basePoly=orthopolynom::chebyshev.t.polynomials,
  kMax=5)
# Now the function chebyFUN
# can be used as any other function:
x <- seq(-1,+1,0.01)
plot(x,chebyFUN(x,5),type="l")
eOuter(seq(-1,+1,0.01),0:3,chebyFUN)

[Package expandFunctions version 0.1.0 Index]