math::quasirandom(3tcl)

๐Ÿ“ฆ
version 2.0 ยท 3 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

โœจ 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 integrated
  • list 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