polywrapper {expandFunctions}R Documentation

Generate special functions using orthonormal functions


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.


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



A polynomial list from orthopoly


Integer. The maximum order of the function generated.


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.


Function which is compatible with eOuter and eMatrixOuter


# 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,
# Now the function chebyFUN
# can be used as any other function:
x <- seq(-1,+1,0.01)

[Package expandFunctions version 0.1.0 Index]