cheby-package: Computes polynomial approximations of arbitrary functions

Description Details Author(s) References See Also Examples

Description

Package to implement Chebychev and shape-preserving Chebychev approximations in one and two dimensions.

Details

Package: cheby
Type: Package
Version: 1.0
Date: 2013-12-24
License: GPL-3

Generates polynomial approximations of arbitrary functions in one and two dimensions, whilst preserving slope, concavity and higher derivatives wherever specified.

d1.poly is the main routine for approximating one-dimensional funcitons. sp1.poly does the same but preserves the sign of an arbitrary number of derivatives. 2-Dimensional Chebychev polynomials are also available with dn.poly. Higher order Chebychev and shape-preserving approximations to follow later.

Comments and suggestions are gratefully received by the author.

Author(s)

Philip Barrett <pobarrett@uchicago.edu>

References

Judd, Kenneth L (1998) Numerical Methods in Economics

See Also

d1.poly, sp1.poly, dn.poly

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Compute basic approximations to natural logarithm
RR <- d1.poly( log, c(0,4), 6, 10 )
SS <- sp1.poly( log, c(0,4), 6, 10, n.shape=c(5,10), 
        sign.deriv=c(1,-1), solver='NLOPT_LD_SLSQP' )
pp <-  seq( 0, 4, length.out=100 )
plot( pp, sapply(pp, RR), lwd=2, col=2, type='l' )
lines( pp, sapply(pp, log), lwd=2, col=1 )
lines( pp, sapply(pp, SS), lwd=2, col=4 )
legend( 'bottomright', c( 'log', 'Order 6 polynomial approx', 
        'Order 6 shape-preserving polynomial approx' ), 
        lwd=2, col=c(1,2,4), bty='n' )

squipbar/cheby documentation built on May 30, 2019, 8 a.m.