ImplfmentationKmpletentation

所属分类:数学计算
开发工具:Visual C++
文件大小:7KB
下载次数:1
上传日期:2018-11-24 02:30:07
上 传 者NEMLripaa+53256
说明:  伪随机数生成器,Implementation of the Quasi-Random Number generator c
(Pseudorandom number generator, Implementation of the Quasi-Random Number generator c)

文件列表:
barray.hpp (2010, 1999-08-01)
quasi.hpp (1450, 1999-08-01)
scalar.hpp (862, 1999-08-01)
status.hpp (941, 1999-08-01)
n2barray.cpp (5201, 1999-08-01)
quasi.cpp (4873, 1999-08-01)
Classes.list (3220, 1999-08-01)

Monte Carlo Integrator V1.4 This class defines an object that performs a Monte Carlo integration. The class is designed to perform the definite integral over any number of dimensions, but a limitation in the present version of the random number generator (see below) limits the number of dimensions to no more than 52 (the limit of the generator itself). The function to integrate should have the prototype: float function(float *x); where the array x represents a vector of point to evaluate the function at. The class methods: MonteIntegrator(Function f,const int d) Declares the integrator to work with function f and to integrate in d dimensions. The number of dimensions defaults to 1. void iterations(const unsigned long int it) Sets the number of iterations to use in the integration (if not used, the integrator defaults to 10,000 iterations). void minmax(const float min, const float max) This method allows the user to inform the object of the known minimum and maximum of the function to integrate. If this method is not called, the object will try to determine the exterema on its own. THIS IS AN OBSOLETE METHOD that is present for backwards compatibility with older versions of this class, it does not do anything. float integral(const float a, const float b, const unsigned long it) Does the integral between the limits a and b for 1-dimensional integrals. If the parameter it is supplied, then that number of iterations is performed. float integral(const float* a, const float* b, const unsigned long it) Does the integral between the limits a[] and b[] for n-dimensional integrals. If the parameter it is supplied, then that number of iterations is performed. By changing the definition of Real in monteint.hpp to double, the object can work with doubles instead of floats. The Random Number generator: The random number generator used by this class generates QUASI-RANDOM numbers. Quasi-random numbers give up any attempt at independence of successive values in order to obtain as uniform a coverage of the domain as possible. This type of coverage improves the convergence rate for Monte Carlo integration. Instead of the 1/Sqrt(N) convergence obtained by the use of pseudo-random numbers, one gets (log(N))^d / N (slightly slower than 1/N) convergence with quasi-random numbers (d is the number of dimensions). The implementation is my C++ version of the FORTRAN code described in the Numerical Recipes column (by W.H. Press and S.A. Teukolsky) in the Nov/Dec 1***9 (V.3 No. 6) issue. The Quasi-random number generator is presently (V1.5) set up for generating data in up to 52 dimensions, but this can be extended if necessary. (see the Press and Teukolsky article for details). Everett (Skip) Carter Phone: 408-***1-0***5 FAX: 408-394-5561 Taygeta Scientific Inc. INTERNET: skip@taygeta.com 1340 Munras Ave., Suite 223 UUCP: ...!uunet!taygeta!skip Monterey, CA. 93940 WWW: http://www.taygeta.com/skip.html

近期下载者

相关文件


收藏者