Home › Tcl Math Library tcllib
math
Tcl Math Library
literal type exactly as shown
argument replace with your value
?optional? may be omitted
Synopsis#
package require Tcl 8.5 9
package require math ?1.2.6?
::math::cov value value ?value ...?
::math::integrate list of xy value pairs
::math::fibonacci n
::math::max value ?value ...?
::math::mean value ?value ...?
::math::min value ?value ...?
::math::product value ?value ...?
::math::random ?value1? ?value2?
::math::sigma value value ?value ...?
::math::stats value value ?value ...?
::math::sum value ?value ...?
Description#
The math package provides utility math functions.
Besides a set of basic commands, available via the package math, there are more specialised packages:
math::bigfloat- Arbitrary-precision floating-point arithmeticmath::bignum- Arbitrary-precision integer arithmeticmath::calculus::romberg- Robust integration methods for functions of one variable, using Romberg integrationmath::calculus- Integration of functions, solving ordinary differential equationsmath::combinatorics- Procedures for various combinatorial functions (for instance the Gamma function and "k out of n")math::complexnumbers- Complex number arithmeticmath::constants- A set of well-known mathematical constants, such as Pi, E, and the golden ratiomath::fourier- Discrete Fourier transformsmath::fuzzy- Fuzzy comparisons of floating-point numbersmath::geometry- 2D geometrical computationsmath::interpolate- Various interpolation methodsmath::linearalgebra- Linear algebra packagemath::optimize- Optimization methodsmath::polynomials- Polynomial arithmetic (includes families of classical polynomials)math::rationalfunctions- Arithmetic of rational functionsmath::roman- Manipulation (including arithmetic) of Roman numeralsmath::special- Approximations of special functions from mathematical physicsmath::statistics- Statistical operations and tests
Basic commands#
::math::covvalue value ?value ...?#-
Return the coefficient of variation expressed as percent of two or more numeric values.
::math::integratelist of xy value pairs#-
Return the area under a "curve" defined by a set of x,y pairs and the error bound as a list.
::math::fibonaccin#-
Return the n'th Fibonacci number.
::math::maxvalue ?value ...?#-
Return the maximum of one or more numeric values.
::math::meanvalue ?value ...?#-
Return the mean, or "average" of one or more numeric values.
::math::minvalue ?value ...?#-
Return the minimum of one or more numeric values.
::math::productvalue ?value ...?#-
Return the product of one or more numeric values.
::math::random?value1? ?value2?#-
Return a random number. If no arguments are given, the number is a floating point value between 0 and 1. If one argument is given, the number is an integer value between 0 and value1. If two arguments are given, the number is an integer value between value1 and value2.
::math::sigmavalue value ?value ...?#-
Return the sample standard deviation of two or more numeric values.
::math::statsvalue value ?value ...?#-
Return the mean, standard deviation, and coefficient of variation (as percent) as a list.
::math::sumvalue ?value ...?#-
Return the sum of one or more numeric values.
Bugs, ideas, feedback#
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category math of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please also report any ideas for enhancements you may have for either package and/or documentation.
When proposing code changes, please provide unified diffs, i.e the output of diff -u.
Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.
Category#
Mathematics