math(3tcl)

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

๐Ÿ’– NAME ๐Ÿ’–

math โ€” the Tcl Math Library, aka your new bestie for numbers ๐Ÿ’…


โœจ 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 ๐ŸŒธ

okay so the math package is literally just a lil bundle of utility math functions. that's the vibe. ๐Ÿงฎโœจ

and like, besides the basic set of commands you get straight from the math package, there are also a whole bunch of more specialised packages, and honestly? iconic lineup:

  • math::bigfloat โ€” Arbitrary-precision floating-point arithmetic
  • math::bignum โ€” Arbitrary-precision integer arithmetic
  • math::calculus::romberg โ€” Robust integration methods for functions of one variable, using Romberg integration
  • math::calculus โ€” Integration of functions, solving ordinary differential equations
  • math::combinatorics โ€” Procedures for various combinatorial functions (for instance the Gamma function and "k out of n")
  • math::complexnumbers โ€” Complex number arithmetic
  • math::constants โ€” A set of well-known mathematical constants, such as Pi, E, and the golden ratio
  • math::fourier โ€” Discrete Fourier transforms
  • math::fuzzy โ€” Fuzzy comparisons of floating-point numbers
  • math::geometry โ€” 2D geometrical computations
  • math::interpolate โ€” Various interpolation methods
  • math::linearalgebra โ€” Linear algebra package
  • math::optimize โ€” Optimization methods
  • math::polynomials โ€” Polynomial arithmetic (includes families of classical polynomials)
  • math::rationalfunctions โ€” Arithmetic of rational functions
  • math::roman โ€” Manipulation (including arithmetic) of Roman numerals
  • math::special โ€” Approximations of special functions from mathematical physics
  • math::statistics โ€” Statistical operations and tests

no cap, that's a whole squad ๐Ÿซถ


๐Ÿ‘‘ BASIC COMMANDS ๐Ÿ‘‘

the main character commands, fr fr:

  • ::math::cov value value ?value ...? โ€” gives you the coefficient of variation expressed as percent of two or more numeric values ๐Ÿ’ฏ
  • ::math::integrate list of xy value pairs โ€” gives you the area under a "curve" defined by a set of x,y pairs, plus the error bound, all as a list ๐Ÿฆ‹
  • ::math::fibonacci n โ€” gives you the n'th Fibonacci number, yes the sequence, you know the one ๐ŸŒˆ
  • ::math::max value ?value ...? โ€” the maximum of one or more numeric values ๐Ÿ‘‘
  • ::math::mean value ?value ...? โ€” the mean, or "average", of one or more numeric values ๐ŸŽ€
  • ::math::min value ?value ...? โ€” the minimum of one or more numeric values ๐Ÿฅบ
  • ::math::product value ?value ...? โ€” the product of one or more numeric values โœ–๏ธ
  • ::math::random ?value1? ?value2? โ€” a random number, and the vibe depends on how many args you pass:
    • no arguments โ†’ a floating point value between 0 and 1 ๐ŸŽฒ
    • one argument โ†’ an integer value between 0 and value1
    • two arguments โ†’ an integer value between value1 and value2
  • ::math::sigma value value ?value ...? โ€” the sample standard deviation of two or more numeric values ๐Ÿ“Š
  • ::math::stats value value ?value ...? โ€” the mean, standard deviation, and coefficient of variation (as percent), served up as a list โญ
  • ::math::sum value ?value ...? โ€” the sum of one or more numeric values โž•

๐Ÿ’€ BUGS, IDEAS, FEEDBACK ๐Ÿ’€

ngl, this document, and the package it describes, will undoubtedly contain bugs and other problems. like, that's just how it is ๐Ÿ˜ญ please report such in the category math of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. and please also report any ideas for enhancements you may have for either package and/or documentation โ€” we love ideas, bestie ๐Ÿซถ

when proposing code changes, please provide unified diffs, i.e the output of diff -u.

also 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. yes, that specific button. the left-most one. go off ๐Ÿ’…


๐Ÿ”‘ KEYWORDS ๐Ÿ”‘

math, statistics


๐Ÿ“ CATEGORY ๐Ÿ“

Mathematics


and that's the whole page, periodt โœจ this was math(3tcl) from the Tcl Math Library, brought to you by tcllib version 1.2.6 โ€” date stamped and everything, ily, go do some math bestie ๐Ÿ’–๐Ÿงš๐ŸŒธ

๐Ÿ“ฆ where this page comes from