math(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

math(n) πŸ’–βœ¨

okay so bestie, welcome to the math(n) page, aka the Tcl Math Library β€” and yes it's as iconic as it sounds. sit down, grab a strawberry πŸ“, we're doing numbers today.


✨ 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 ...?

like. look at her. a whole roster. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so the math package is your go-to girl for utility math functions. that's the vibe. 🫢

but wait, there's more β€” besides this set of basic commands (which you get straight from the math package), there are a bunch of more specialised packages that are whole entire side quests. each one is its own main character:

  • 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::complexnumbers… okay not repeating, next one:
  • 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

okay so slight edit bestie, that list is exactly these, no more no less, don't let me gaslight you: math::bigfloat, math::bignum, math::calculus::romberg, math::calculus, math::combinatorics, math::complexnumbers, math::constants, math::fourier, math::fuzzy, math::geometry, math::interpolate, math::linearalgebra, math::optimize, math::polynomials, math::rationalfunctions, math::roman, math::special, math::statistics. periodt. πŸ’œ


πŸ‘‘ BASIC COMMANDS πŸ‘‘

these are the day-ones. the ride-or-dies. the ones you get just by requiring math.

  • ::math::cov value value ?value ...? β€” gives you the coefficient of variation, expressed as a percent, of two or more numeric values. (two minimum, bestie, it needs at least a duo.)
  • ::math::integrate list of xy value pairs β€” returns the area under a "curve" defined by a set of x,y pairs, plus the error bound, all as a list. it's giving calculus but make it chill.
  • ::math::fibonacci n β€” returns the n'th Fibonacci number. that's it. that's the tweet. ✨
  • ::math::max value ?value ...? β€” the maximum of one or more numeric values. the biggest one. the main character. πŸ‘‘
  • ::math::mean value ?value ...? β€” the mean, or "average", of one or more numeric values. literally the average, no cap.
  • ::math::min value ?value ...? β€” the minimum of one or more numeric values. the smallest, but she still matters. πŸ₯Ί
  • ::math::product value ?value ...? β€” the product of one or more numeric values. multiply, multiply, slay.
  • ::math::random ?value1? ?value2? β€” returns a random number. the deets:
    • no arguments at all? you get a floating point value between 0 and 1. 🎲
    • one argument? you get an integer value between 0 and value1.
    • two arguments? you get an integer value between value1 and value2.
  • ::math::sigma value value ?value ...? β€” returns the sample standard deviation of two or more numeric values.
  • ::math::stats value value ?value ...? β€” returns the mean, standard deviation, and coefficient of variation (as percent) β€” all bundled up as a list. a little combo meal. 🍟
  • ::math::sum value ?value ...? β€” the sum of one or more numeric values. adding things. iconic behaviour.

πŸ’€ BUGS, IDEAS, FEEDBACK πŸ’€

ngl bestie, this document β€” and the package it describes β€” will undoubtedly contain bugs and other problems. it's not a vibe, it's just reality. 😭

so if you find one, please report it in the category math of the Tcllib Trackers at http://core.tcl.tk/tcllib/reportlist. 🫢

also please send in any ideas for enhancements you may have for either the package and/or the documentation. we want the glow-up.

when you're proposing code changes, please provide unified diffs, i.e the output of diff -u. that's the format, don't freestyle it.

and one more thing β€” note further that attachments are strongly preferred over inlined patches. here's how you do it: go to the Edit form of the ticket immediately after its creation, and then use the left-most button in the secondary navigation bar. easy. πŸ’…


🌈 KEYWORDS 🌈

math, statistics


⭐ CATEGORY ⭐

Mathematics


okay that's the whole page, you ate it up πŸ’– and just so you know where this came from: it's from tcllib, version 1.2.6, page math(n). stan. bye bestie, go do some math πŸ§šβœ¨πŸŽ€

πŸ“¦ where this page comes from