Math - constants and functions
use Math; printf "2.71828182845905 = %s\n", E; printf "1.5707963267949 = %s\n", PI1_2; printf "1 = %s\n", round(0.5); printf "1 = %s\n", ceil(0.5); printf "0 = %s\n", floor(0.5); or use Math (); printf "%s\n", Math::PI; printf "%s\n", Math::round(0.5);
perlfunc Perl built-in functions
PDL for scientific and bulk numeric data processing and display
POSIX
Math::Complex, Math::Trig, Math::Quaternion, Math::Vectors
Euler's constant, e, approximately 2.718
Natural logarithm of 10, approximately 2.302
Natural logarithm of 2, approximately 0.693
Ratio of the circumference of a circle to its diameter, approximately 3.1415 or atan2( 0, -1 ).
PI1_2 == PI * 1/2
square root of 1/2, approximately 0.707
square root of 2, approximately 1.414
Note number, number1, number2, base, and exponent indicate any expression with a scalar value.
Returns the absolute value of number
Returns the arc cosine (in radians) of number
Returns the arc sine (in radians) of number
Returns the arc tangent (in radians) of number
perls atan2
Returns the least integer greater than or equal to number
Returns the cosine of number where number is expressed in radians
Returns e, to the power of number (i.e. enumber)
Returns 1 if number is even otherwise 0
Returns the greatest integer less than or equal to its argument
POSIX fmod
Returns the natural logarithm (base e) of number
Returns the logarithm (base 10) of number
Returns the lesser of number1 and number2
Returns the greater of number1 and number2
Returns number between or equal min and max
Returns 1 if number is odd otherwise 0
Returns base to the exponent power (i.e. base exponent) $base ** $exponent == pow($base, $exponent);
Returns the product of its arguments pro(1,2,3) == 1 * 2 * 3; my $product = pro(@array);
Returns a pseudo-random number between 0 and 1.
Returns a pseudo-random number between 0 and number.
Returns a pseudo-random number between number1 and number2.
Returns the value of number rounded to the nearest integer
round(0.123456, 2) == 0.12; round(50, -2) == 100; round(5, -1) == 10; round(0.5) == 1; round(0.05, 1) == 0.1; round(0.005, 2) == 0.01;
Returns 1 if number is greater 0. Returns -1 if number is lesser 0 otherwise -1.
Returns the sine of number where number is expressed in radians
Returns the square root of its argument
Returns the sum of its arguments sum(1..3) == 1 + 2 + 3; my $sum = sum(@array);
Returns the tangent of number, where number is expressed in radians
perlfunc
Math
Math::Algebra::Symbols
Math::Algebra::Symbols::Sum
Math::Algebra::Symbols::Term
Math::Algebra::SymbolsSum
Math::Algebra::SymbolsTerm
Math::Amoeba
Math::Approx
Math::Approx::Symbolic
Math::Base36
Math::Base85
Math::BaseArith
Math::BaseCalc
Math::BaseCnv
Math::Bezier
Math::Bezier::Convert
Math::Big
Math::Big::Factors
Math::BigFloat
Math::BigFloat::Trace
Math::BigInt
Math::BigInt::BitVect
Math::BigInt::Calc
Math::BigInt::CalcEmu
Math::BigInt::Constant
Math::BigInt::FastCalc
Math::BigInt::GMP
Math::BigInt::Lite
Math::BigInt::Named
Math::BigInt::Named::English
Math::BigInt::Named::German
Math::BigInt::Pari
Math::BigInt::Random
Math::BigInt::Scalar
Math::BigInt::Trace
Math::BigIntFast
Math::BigInteger
Math::BigRat
Math::BigSimple
Math::BooleanEval
Math::Brent
Math::Business::BlackSch
Math::Business::BlackScholes
Math::Business::EMA
Math::Business::MACD
Math::Business::SMA
Math::CDF
Math::Calc::Euro
Math::Calc::Units
Math::Calc::Units::Compute
Math::Calc::Units::Convert
Math::Calc::Units::Convert::Base
Math::Calc::Units::Convert::Base2Metric
Math::Calc::Units::Convert::Byte
Math::Calc::Units::Convert::Combo
Math::Calc::Units::Convert::Date
Math::Calc::Units::Convert::Distance
Math::Calc::Units::Convert::Metric
Math::Calc::Units::Convert::Multi
Math::Calc::Units::Convert::Time
Math::Calc::Units::Grammar
Math::Calc::Units::Rank
Math::Calculator
Math::Calculus::Differentiate
Math::Calculus::NewtonRaphson
Math::Calculus::TaylorEquivalent
Math::Calculus::TaylorSeries
Math::CatmullRom
Math::Cephes
Math::Cephes::Complex
Math::Cephes::Fraction
Math::Cephes::Matrix
Math::Cephes::Polynomial
Math::Color
Math::ColorRGBA
Math::Combinatorics
Math::Complex
Math::ConvexHull
Math::Counting
Math::Currency
Math::Currency::GBP
Math::Currency::JPY
Math::Curve::Hilbert
Math::Derivative
Math::ES
Math::ErrorPropagation
Math::Evol
Math::Expr
Math::Expr::FormulaDB
Math::Expr::MatchSet
Math::Expr::Node
Math::Expr::Num
Math::Expr::Opp
Math::Expr::OpperationDB
Math::Expr::Rule
Math::Expr::TypeDB
Math::Expr::Var
Math::Expr::VarSet
Math::Expression
Math::FFT
Math::FFTW
Math::Factor::XS
Math::Fibonacci
Math::Fibonacci::Phi
Math::Financial
Math::FitRect
Math::FixedPrecision
Math::Fleximal
Math::Fortran
Math::Fourier
Math::Fractal::Curve
Math::Fractal::DLA
Math::Fractal::DLA::Explode
Math::Fractal::DLA::GrowUp
Math::Fractal::DLA::Race2Center
Math::Fractal::DLA::Surrounding
Math::Fractal::Mandelbrot
Math::Fraction
Math::FractionDemo
Math::FresnalZone
Math::FresnelZone
Math::Function::Roots
Math::GAP
Math::GMP
Math::GMPf
Math::GMPq
Math::GMPz
Math::GMatrix
Math::GSL
Math::GammaFunction
Math::Geometry
Math::Geometry::GPC
Math::Geometry::Planar
Math::Geometry::Planar::GPC
Math::Geometry::Planar::GPC::Inherit
Math::Geometry::Planar::GPC::Polygon
Math::Geometry::Planar::Offset
Math::Gradient
Math::GrahamFunction
Math::GrahamFunction::Object
Math::GrahamFunction::SqFacts
Math::GrahamFunction::SqFacts::Dipole
Math::Group::Thompson
Math::Gsl
Math::Gsl::Polynomial
Math::Gsl::Sf
Math::HashSum
Math::Int64
Math::Integral
Math::Integral::Romberg
Math::Interpolate
Math::Interpolator
Math::Interpolator::Knot
Math::Interpolator::Linear
Math::Interpolator::Robust
Math::Interpolator::Source
Math::Intersection::StraightLine
Math::Interval
Math::IntervalSearch
Math::LP
Math::LP::Constraint
Math::LP::LinearCombination
Math::LP::Object
Math::LP::Solve
Math::LP::Variable
Math::Libm
Math::LinearCombination
Math::LinearProg
Math::LogRand
Math::Logic
Math::Logic::Predicate
Math::Logic::Ternary
Math::MPFR
Math::MVPoly
Math::MVPoly::Ideal
Math::MVPoly::Integer
Math::MVPoly::Monomial
Math::MVPoly::Parser
Math::MVPoly::Polynomial
Math::Macopt
Math::MagicSquare
Math::MagicSquare::Generator
Math::Matlab
Math::Matlab::Engine
Math::Matlab::Local
Math::Matlab::Pool
Math::Matlab::Remote
Math::Matlab::Server
Math::Matrix
Math::Matrix::SVD
Math::MatrixBool
Math::MatrixCplx
Math::MatrixReal
Math::MatrixReal::Ext1
Math::MatrixSparse
Math::MultiplicationTable
Math::NoCarry
Math::Nocarry
Math::NumberCruncher
Math::Numbers
Math::ODE
Math::Orthonormalize
Math::PRSG
Math::Pari
Math::PariBuild
Math::PartialOrder
Math::PartialOrder::Base
Math::PartialOrder::CEnum
Math::PartialOrder::CMasked
Math::PartialOrder::Caching
Math::PartialOrder::LRUCaching
Math::PartialOrder::Loader
Math::PartialOrder::Std
Math::Polygon
Math::Polygon::Calc
Math::Polygon::Clip
Math::Polygon::Surface
Math::Polygon::Transform
Math::Polyhedra
Math::Polynom
Math::Polynomial
Math::Polynomial::Solve
Math::Prime::XS
Math::Project
Math::Project3D
Math::Project3D::Function
Math::Project3D::Plot
Math::Quaternion
Math::RPN
Math::Rand48
Math::Random
Math::Random::AcceptReject
Math::Random::Brownian
Math::Random::Cauchy
Math::Random::MT
Math::Random::MT::Auto
Math::Random::MT::Auto::Range
Math::Random::MT::Auto::Util
Math::Random::OO
Math::Random::OO::Bootstrap
Math::Random::OO::Normal
Math::Random::OO::Uniform
Math::Random::OO::UniformInt
Math::Random::TT800
Math::RandomOrg
Math::Roman
Math::Rotation
Math::Round
Math::Round::Var
Math::RungeKutta
Math::SO3
Math::Sequence
Math::Series
Math::SigFigs
Math::Simple
Math::SimpleInterest
Math::SimpleVariable
Music::is::Math
Math::Sparse::Matrix
Math::Sparse::Vector
Math::SparseMatrix
Math::SparseVector
Math::Spline
Math::Stat
Math::String
Math::String::Charset
Math::String::Charset::Grouped
Math::String::Charset::Nested
Math::String::Charset::Wordlist
Math::String::Sequence
Math::Symbolic
Math::Symbolic::AuxFunctions
Math::Symbolic::Base
Math::Symbolic::Compiler
Math::Symbolic::Constant
Math::Symbolic::Custom
Math::Symbolic::Custom::Base
Math::Symbolic::Custom::CCompiler
Math::Symbolic::Custom::Contains
Math::Symbolic::Custom::DefaultDumpers
Math::Symbolic::Custom::DefaultMods
Math::Symbolic::Custom::DefaultTests
Math::Symbolic::Custom::ErrorPropagation
Math::Symbolic::Custom::LaTeXDumper
Math::Symbolic::Custom::Pattern
Math::Symbolic::Custom::Pattern::Export
Math::Symbolic::Custom::Simplification
Math::Symbolic::Custom::Transformation
Math::Symbolic::Custom::Transformation::Group
Math::Symbolic::Derivative
Math::Symbolic::ExportConstants
Math::Symbolic::MiscAlgebra
Math::Symbolic::MiscCalculus
Math::Symbolic::Operator
Math::Symbolic::Parser
Math::Symbolic::Parser::Precompiled
Math::Symbolic::Parser::Yapp
Math::Symbolic::Variable
Math::Symbolic::VectorCalculus
Math::SymbolicX::BigNum
Math::SymbolicX::Calculator
Math::SymbolicX::Calculator::Command
Math::SymbolicX::Calculator::Command::Assignment
Math::SymbolicX::Calculator::Command::DerivativeApplication
Math::SymbolicX::Calculator::Command::Insertion
Math::SymbolicX::Calculator::Command::Transformation
Math::SymbolicX::Calculator::Interface
Math::SymbolicX::Calculator::Interface::Shell
Math::SymbolicX::Calculator::Interface::Web
Math::SymbolicX::Calculator::Interface::Web::Server
Math::SymbolicX::Complex
Math::SymbolicX::Error
Math::SymbolicX::Inline
Math::SymbolicX::NoSimplification
Math::SymbolicX::ParserExtensionFactory
Math::SymbolicX::Statistics::Distributions
Math::Systems
Math::Taylor
Math::Telephony::ErlangB
Math::Telephony::ErlangC
Math::TotalBuilder
Math::TotalBuilder::Common
Math::TriangularNumbers
Math::Trig
Math::Trig::Degree
Math::Trig::Gradian
Math::Trig::Radian
Math::Trig::Units
Math::TrulyRandom
Math::Units
Math::Units::PhysicalValue
Math::Vec
Math::Vec2
Math::Vec3
Math::VecStat
Math::Vector
Math::Vectors
Math::Vector::SortIndexes
Math::VectorReal
Math::Zap::Vector
Math::Zap::Vector2
Math::Volume::Rotational
Math::WalshTransform
Math::XOR
Math::Zap::Color
Math::Zap::Cube
Math::Zap::Draw
Math::Zap::Exports
Math::Zap::Line2
Math::Zap::Matrix
Math::Zap::Matrix2
Math::Zap::Rectangle
Math::Zap::Triangle
Math::Zap::Triangle2
Math::Zap::Unique
Math::ematica
If you run into a miscalculation, need some sort of feature or an additional holiday, or if you know of any new changes to the funky math, please drop the author a note.
Holger Seelig holger.seelig@yahoo.de
This is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Math, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math
CPAN shell
perl -MCPAN -e shell install Math
For more information on module installation, please visit the detailed CPAN module installation guide.