math::quasirandom(3tcl)
โจ math::quasirandom โจ
okay bestie, welcome to the Tcl Math Library's quasi-random era ๐ this is the manual page for math::quasirandom โ quasi-random points for integration and Monte Carlo type methods, no cap.
๐ธ NAME ๐ธ
math::quasirandom โ quasi-random points for integration and Monte Carlo type methods ๐ฒโจ
๐ฆ SYNOPSIS ๐ฆ
package require Tcl 8.6 9
package require TclOO
package require math::quasirandom 1.1
::math::quasirandom::qrpoint create NAME DIM ?ARGS?
gen next
gen set-start index
gen set-evaluations number
gen integral func minmax args
๐ DESCRIPTION ๐
so like, in so many applications, pseudo-random numbers and pseudo-random points in a (limited) sample space are doing the absolute most. think any type of Monte Carlo simulation, bestie. but here's the tea ๐ต โ pseudo-random numbers can be too random, and because of that you need a whole giant pile of data points just to squash the error or fluctuation in your results down to the value you actually wanted. exhausting, honestly ๐ญ
Quasi-random numbers are the alternative, and they ate. instead of "completely" arbitrary points, you generate points that are diverse enough to cover the entire sample space in a more or less uniform way ๐ as a consequence, convergence to the limit can be much faster when such quasi-random numbers are well-chosen. periodt ๐
The package defines a class "qrpoint" that creates a command to generate quasi-random points in 1, 2 or more dimensions โจ That command can either generate separate points โ so you can use them in your own user-defined algorithm โ or it can use those points to calculate integrals of functions defined over 1, 2 or more dimensions ๐ฅ It also holds several other common algorithms.
(NOTE: these are not implemented yet) ๐ญ๐
One particular characteristic of the generators is that there are no tuning parameters involved, which makes the use particularly simple ๐ซถ no fiddling, no drama, we love that for us.
๐ COMMANDS ๐
A quasi-random point generator is created using the qrpoint class:
๐ ::math::quasirandom::qrpoint create NAME DIM ?ARGS?
This command takes the following arguments:
string NAMEโ the name of the command to be created (alternatively: the new subcommand will generate a unique name) โจinteger/string DIMโ the number of dimensions, or one of:"circle","disk","sphere"or"ball"๐strings ARGSโ zero or more key-value pairs. The supported options are:-start indexโ the index for the next point to be generated (default:1)-evaluations numberโ the number of evaluations to be used by default (default:100)
The points that are returned lie in the hyperblock [0,1[^n (n the number of dimensions) or on the unit circle, within the unit disk, on the unit sphere or within the unit ball ๐๐
Each generator supports the following subcommands:
๐ gen next
Return the coordinates of the next quasi-random point ๐ฏ
๐ gen set-start index
Reset the index for the next quasi-random point. This is useful to control which list of points is returned. Returns the new or the current value, if no value is given ๐
๐ gen set-evaluations number
Reset the default number of evaluations in compound algorithms. Note that the actual number is the smallest 4-fold larger or equal to the given number. (The 4-fold plays a role in the detailed integration routine.) ๐งฎ
๐ gen integral func minmax args
Calculate the integral of the given function over the block (or the circle, sphere etc.) ๐
string funcโ the name of the function to be integratedlist minmaxโ list of pairs of minimum and maximum coordinates. This can be used to map the quasi-random coordinates to the desired hyper-block.- If the space is a circle, disk etc. then this argument should be a single value, the radius. The circle, disk, etc. is centred at the origin. If this is not what is required, then a coordinate transformation should be made within the function ๐
strings argsโ zero or more key-value pairs. The following options are supported:-evaluations numberโ the number of evaluations to be used. If not specified use the default of the generator object.
๐ TODO ๐
- Implement other algorithms and variants
- Implement more unit tests.
- Comparison to pseudo-random numbers for integration.
๐ REFERENCES ๐
Various algorithms exist for generating quasi-random numbers. The generators created in this package are based on: http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/ ๐
๐ท๏ธ KEYWORDS ๐ท๏ธ
mathematics, quasi-random
๐ CATEGORY ๐
Mathematics
and that's the whole page, bestie ๐ซถ this one came from tcllib, version 1.1, and it's the math::quasirandom(3tcl) manual โ go generate some unreasonably effective points for me, mwah ๐โจ๐
๐ฆ where this page comes from
- debian trixie: tcllib 2.0+dfsg-4 ยท Tcl
- ubuntu questing: tcllib 2.0+dfsg-4
- ubuntu resolute: tcllib 2.0+dfsg-5 ยท Tcl
- ubuntu stonking: tcllib 2.0+dfsg-6 ยท Tcl
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms