Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

constants(n) [osx man page]

math::constants(n)						 Tcl Math Library						math::constants(n)

__________________________________________________________________________________________________________________________________________________

NAME
math::constants - Mathematical and numerical constants SYNOPSIS
package require Tcl ?8.3? package require math::constants ?1.0.1? ::math::constants::constants args ::math::constants::print-constants args _________________________________________________________________ DESCRIPTION
This package defines some common mathematical and numerical constants. By using the package you get consistent values for numbers like pi and ln(10). It defines two commands: o One for importing the constants o One for reporting which constants are defined and what values they actually have. The motivation for this package is that quite often, with (mathematical) computations, you need a good approximation to, say, the ratio of degrees to radians. You can, of course, define this like: variable radtodeg [expr {180.0/(4.0*atan(1.0))}] and use the variable radtodeg whenever you need the conversion. This has two drawbacks: o You need to remember the proper formula or value and that is error-prone. o Especially with the use of mathematical functions like atan you assume that they have been accurately implemented. This is seldom or never the case and for each platform you can get subtle differences. Here is the way you can do it with the math::constants package: package require math::constants ::math::constants::constants radtodeg degtorad which creates two variables, radtodeg and (its reciprocal) degtorad in the calling namespace. Constants that have been defined (their values are mostly taken from mathematical tables with more precision than usually can be handled) include: o basic constants like pi, e, gamma (Euler's constant) o derived values like ln(10) and sqrt(2) o purely numerical values such as 1/3 that are included for convenience and for the fact that certain seemingly trivial computations like: set value [expr {3.0*$onethird}] give exactly the value you expect (if IEEE arithmetic is available). PROCEDURES
The package defines the following public procedures: ::math::constants::constants args Import the constants whose names are given as arguments ::math::constants::print-constants args Print the constants whose names are given as arguments on the screen (name, value and description) or, if no arguments are given, print all defined constants. This is mainly a convenience procedure. BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category math :: constants of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
constants, degrees, e, math, pi, radians CATEGORY
Mathematics COPYRIGHT
Copyright (c) 2004 Arjen Markus <arjenmarkus@users.sourceforge.net> math 1.0.1 math::constants(n)

Check Out this Related Man Page

math(n)                                                          Tcl Math Library                                                          math(n)

__________________________________________________________________________________________________________________________________________________

NAME
math - Tcl Math Library SYNOPSIS
package require Tcl 8.2 package require math ?1.2.4? ::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: o math::bigfloat - Arbitrary-precision floating-point arithmetic o math::bignum - Arbitrary-precision integer arithmetic o math::calculus::romberg - Robust integration methods for functions of one variable, using Romberg integration o math::calculus - Integration of functions, solving ordinary differential equations o math::combinatorics - Procedures for various combinatorial functions (for instance the Gamma function and "k out of n") o math::complexnumbers - Complex number arithmetic o math::constants - A set of well-known mathematical constants, such as Pi, E, and the golden ratio o math::fourier - Discrete Fourier transforms o math::fuzzy - Fuzzy comparisons of floating-point numbers o math::geometry - 2D geometrical computations o math::interpolate - Various interpolation methods o math::linearalgebra - Linear algebra package o math::optimize - Optimization methods o math::polynomials - Polynomial arithmetic (includes families of classical polynomials) o math::rationalfunctions - Arithmetic of rational functions o math::roman - Manipulation (including arithmetic) of Roman numerals o math::special - Approximations of special functions from mathematical physics o math::statistics - Statistical operations and tests BASIC COMMANDS
::math::cov value value ?value ...? Return the coefficient of variation expressed as percent of two or more numeric values. ::math::integrate list 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::fibonacci n Return the n'th Fibonacci number. ::math::max value ?value ...? Return the maximum of one or more numeric values. ::math::mean value ?value ...? Return the mean, or "average" of one or more numeric values. ::math::min value ?value ...? Return the minimum of one or more numeric values. ::math::product value ?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::sigma value value ?value ...? Return the population standard deviation of two or more numeric values. ::math::stats value value ?value ...? Return the mean, standard deviation, and coefficient of variation (as percent) as a list. ::math::sum value ?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 SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
math, statistics math 1.2.4 math(n)
Man Page