Rの近似

??approximation
The search string was "approximation"
Help pages:
bayesm::ghkvec 		Compute GHK approximation to Multivariate Normal Integrals
bayesm::logMargDenNR 		Compute Log Marginal Density Using Newton-Raftery Approx
boot::linear.approx 		Linear Approximation of Bootstrap Replicates
boot::lines.saddle.distn 		Add a Saddlepoint Approximation to a Plot
boot::norm.ci 		Normal Approximation Confidence Intervals
boot::print.saddle.distn 		Print Quantiles of Saddlepoint Approximations
boot::saddle 		Saddlepoint Approximations for Bootstrap Statistics
boot::saddle.distn 		Saddlepoint Distribution Approximations for Bootstrap Statistics
boot::saddle.distn.object 		Saddlepoint Distribution Approximation Objects
bqtl::adjust.linear.bayes 		Use Laplace Approximations to improve linear approximations to the posterior
bqtl::summary.adj 		Summarize Laplace approximations
mixAK::BLA 		Best linear approximation with respect to the mean square error (theoretical linear regression).
mixtools::boot.se 		Performs Parametric Bootstrap for Standard Error Approximation
pracma::chebApprox 		Chebyshev Approximation
pracma::pade 		Pade Approximation
pracma::polyApprox 		Polynomial Approximation
pracma::rationalfit 		Rational Function Approximation
pracma::taylor 		Taylor Series Approximation
pracma::trigApprox 		Trigonometric Approximation
spatstat::as.mask 		Pixel Image Approximation of a Window
VGAM::huggins91 		Huggins (1991) Capture-recapture Model Family Function (approximation only)
MASS::fractions 		Rational Approximation
MASS::rational 		Rational Approximation
library(pracma)
my.function<-function(x){
	sin(x)+cos(x^2)
}

n<-1:20
precision<-rep(0,length(n))
for(i in 1:length(n)){
	out<-polyApprox(my.function, -pi/2, pi/2, n[i])
	precision[i]<-out$estim.prec
}
plot(n,precision)
f <- polyApprox(my.function, -pi/2, pi/2, 100)$f
x <- seq(-pi/2, pi/2, length.out = 100)
y <- my.function(x) - f(x)
plot(x, y, type = "l", col = "blue")
grid()