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);
the perlfunc manpage Perl built-in functions
PDL for scientific and bulk numeric data processing and display
the Math::Complex manpage, the Math::Trig manpage, the Math::Quaternion manpage, the Math::Vectors manpage
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 the product of its arguments
pro(1,2,3) == 1 * 2 * 3;
my $product = pro(@array);
Computes $x raised to the power $exponent .
$ret = POSIX::pow( $x, $exponent );
You can also use the ** operator, see the perlop manpage.
Returns a pseudo-random number between 0 and 1.
$ret = Math::random();
Returns a pseudo-random number between 0 and $number1.
$ret = Math::random($number1);
Returns a pseudo-random number between number1 and number2.
$ret = Math::random($number1, $number2);
Returns the value of $number rounded to the nearest integer
$ret = Math::round($number);
Returns the value of $number rounded to the nearest float point number.
$ret = round($number, $digits);
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
the Math::Algebra::Symbols manpage
the Math::Algebra::Symbols::Sum manpage
the Math::Algebra::Symbols::Term manpage
the Math::Algebra::SymbolsSum manpage
the Math::Algebra::SymbolsTerm manpage
the Math::Approx::Symbolic manpage
the Math::Bezier::Convert manpage
the Math::Big::Factors manpage
the Math::BigFloat::Trace manpage
the Math::BigInt::BitVect manpage
the Math::BigInt::Calc manpage
the Math::BigInt::CalcEmu manpage
the Math::BigInt::Constant manpage
the Math::BigInt::FastCalc manpage
the Math::BigInt::Lite manpage
the Math::BigInt::Named manpage
the Math::BigInt::Named::English manpage
the Math::BigInt::Named::German manpage
the Math::BigInt::Pari manpage
the Math::BigInt::Random manpage
the Math::BigInt::Scalar manpage
the Math::BigInt::Trace manpage
the Math::Business::BlackSch manpage
the Math::Business::BlackScholes manpage
the Math::Business::EMA manpage
the Math::Business::MACD manpage
the Math::Business::SMA manpage
the Math::Calc::Units::Compute manpage
the Math::Calc::Units::Convert manpage
the Math::Calc::Units::Convert::Base manpage
the Math::Calc::Units::Convert::Base2Metric manpage
the Math::Calc::Units::Convert::Byte manpage
the Math::Calc::Units::Convert::Combo manpage
the Math::Calc::Units::Convert::Date manpage
the Math::Calc::Units::Convert::Distance manpage
the Math::Calc::Units::Convert::Metric manpage
the Math::Calc::Units::Convert::Multi manpage
the Math::Calc::Units::Convert::Time manpage
the Math::Calc::Units::Grammar manpage
the Math::Calc::Units::Rank manpage
the Math::Calculus::Differentiate manpage
the Math::Calculus::NewtonRaphson manpage
the Math::Calculus::TaylorEquivalent manpage
the Math::Calculus::TaylorSeries manpage
the Math::Cephes::Complex manpage
the Math::Cephes::Fraction manpage
the Math::Cephes::Matrix manpage
the Math::Cephes::Polynomial manpage
the Math::Combinatorics manpage
the Math::Currency::GBP manpage
the Math::Currency::JPY manpage
the Math::Curve::Hilbert manpage
the Math::ErrorPropagation manpage
the Math::Expr::FormulaDB manpage
the Math::Expr::MatchSet manpage
the Math::Expr::OpperationDB manpage
the Math::Expr::TypeDB manpage
the Math::Expr::VarSet manpage
the Math::Fibonacci::Phi manpage
the Math::FixedPrecision manpage
the Math::Fractal::Curve manpage
the Math::Fractal::DLA manpage
the Math::Fractal::DLA::Explode manpage
the Math::Fractal::DLA::GrowUp manpage
the Math::Fractal::DLA::Race2Center manpage
the Math::Fractal::DLA::Surrounding manpage
the Math::Fractal::Mandelbrot manpage
the Math::FractionDemo manpage
the Math::Function::Roots manpage
the Math::GammaFunction manpage
the Math::Geometry::GPC manpage
the Math::Geometry::Planar manpage
the Math::Geometry::Planar::GPC manpage
the Math::Geometry::Planar::GPC::Inherit manpage
the Math::Geometry::Planar::GPC::Polygon manpage
the Math::Geometry::Planar::Offset manpage
the Math::GrahamFunction manpage
the Math::GrahamFunction::Object manpage
the Math::GrahamFunction::SqFacts manpage
the Math::GrahamFunction::SqFacts::Dipole manpage
the Math::Group::Thompson manpage
the Math::Gsl::Polynomial manpage
the Math::Integral::Romberg manpage
the Math::Interpolator manpage
the Math::Interpolator::Knot manpage
the Math::Interpolator::Linear manpage
the Math::Interpolator::Robust manpage
the Math::Interpolator::Source manpage
the Math::Intersection::StraightLine manpage
the Math::IntervalSearch manpage
the Math::LP::Constraint manpage
the Math::LP::LinearCombination manpage
the Math::LP::Variable manpage
the Math::LinearCombination manpage
the Math::Logic::Predicate manpage
the Math::Logic::Ternary manpage
the Math::MVPoly::Ideal manpage
the Math::MVPoly::Integer manpage
the Math::MVPoly::Monomial manpage
the Math::MVPoly::Parser manpage
the Math::MVPoly::Polynomial manpage
the Math::MagicSquare::Generator manpage
the Math::Matlab::Engine manpage
the Math::Matlab::Local manpage
the Math::Matlab::Pool manpage
the Math::Matlab::Remote manpage
the Math::Matlab::Server manpage
the Math::MatrixReal::Ext1 manpage
the Math::MatrixSparse manpage
the Math::MultiplicationTable manpage
the Math::NumberCruncher manpage
the Math::Orthonormalize manpage
the Math::PartialOrder manpage
the Math::PartialOrder::Base manpage
the Math::PartialOrder::CEnum manpage
the Math::PartialOrder::CMasked manpage
the Math::PartialOrder::Caching manpage
the Math::PartialOrder::LRUCaching manpage
the Math::PartialOrder::Loader manpage
the Math::PartialOrder::Std manpage
the Math::Polygon::Calc manpage
the Math::Polygon::Clip manpage
the Math::Polygon::Surface manpage
the Math::Polygon::Transform manpage
the Math::Polynomial::Solve manpage
the Math::Project3D::Function manpage
the Math::Project3D::Plot manpage
the Math::Random::AcceptReject manpage
the Math::Random::Brownian manpage
the Math::Random::Cauchy manpage
the Math::Random::MT::Auto manpage
the Math::Random::MT::Auto::Range manpage
the Math::Random::MT::Auto::Util manpage
the Math::Random::OO::Bootstrap manpage
the Math::Random::OO::Normal manpage
the Math::Random::OO::Uniform manpage
the Math::Random::OO::UniformInt manpage
the Math::Random::TT800 manpage
the Math::SimpleInterest manpage
the Math::SimpleVariable manpage
Music::is::Math
the Math::Sparse::Matrix manpage
the Math::Sparse::Vector manpage
the Math::SparseMatrix manpage
the Math::SparseVector manpage
the Math::String::Charset manpage
the Math::String::Charset::Grouped manpage
the Math::String::Charset::Nested manpage
the Math::String::Charset::Wordlist manpage
the Math::String::Sequence manpage
the Math::Symbolic::AuxFunctions manpage
the Math::Symbolic::Base manpage
the Math::Symbolic::Compiler manpage
the Math::Symbolic::Constant manpage
the Math::Symbolic::Custom manpage
the Math::Symbolic::Custom::Base manpage
the Math::Symbolic::Custom::CCompiler manpage
the Math::Symbolic::Custom::Contains manpage
the Math::Symbolic::Custom::DefaultDumpers manpage
the Math::Symbolic::Custom::DefaultMods manpage
the Math::Symbolic::Custom::DefaultTests manpage
the Math::Symbolic::Custom::ErrorPropagation manpage
the Math::Symbolic::Custom::LaTeXDumper manpage
the Math::Symbolic::Custom::Pattern manpage
the Math::Symbolic::Custom::Pattern::Export manpage
the Math::Symbolic::Custom::Simplification manpage
the Math::Symbolic::Custom::Transformation manpage
the Math::Symbolic::Custom::Transformation::Group manpage
the Math::Symbolic::Derivative manpage
the Math::Symbolic::ExportConstants manpage
the Math::Symbolic::MiscAlgebra manpage
the Math::Symbolic::MiscCalculus manpage
the Math::Symbolic::Operator manpage
the Math::Symbolic::Parser manpage
the Math::Symbolic::Parser::Precompiled manpage
the Math::Symbolic::Parser::Yapp manpage
the Math::Symbolic::Variable manpage
the Math::Symbolic::VectorCalculus manpage
the Math::SymbolicX::BigNum manpage
the Math::SymbolicX::Calculator manpage
the Math::SymbolicX::Calculator::Command manpage
the Math::SymbolicX::Calculator::Command::Assignment manpage
the Math::SymbolicX::Calculator::Command::DerivativeApplication manpage
the Math::SymbolicX::Calculator::Command::Insertion manpage
the Math::SymbolicX::Calculator::Command::Transformation manpage
the Math::SymbolicX::Calculator::Interface manpage
the Math::SymbolicX::Calculator::Interface::Shell manpage
the Math::SymbolicX::Calculator::Interface::Web manpage
the Math::SymbolicX::Calculator::Interface::Web::Server manpage
the Math::SymbolicX::Complex manpage
the Math::SymbolicX::Error manpage
the Math::SymbolicX::Inline manpage
the Math::SymbolicX::NoSimplification manpage
the Math::SymbolicX::ParserExtensionFactory manpage
the Math::SymbolicX::Statistics::Distributions manpage
the Math::Telephony::ErlangB manpage
the Math::Telephony::ErlangC manpage
the Math::TotalBuilder manpage
the Math::TotalBuilder::Common manpage
the Math::TriangularNumbers manpage
the Math::Trig::Degree manpage
the Math::Trig::Gradian manpage
the Math::Trig::Radian manpage
the Math::Units::PhysicalValue manpage
the Math::Vector::SortIndexes manpage
the Math::Zap::Vector2 manpage
the Math::Volume::Rotational manpage
the Math::WalshTransform manpage
the Math::Zap::Exports manpage
the Math::Zap::Matrix2 manpage
the Math::Zap::Rectangle manpage
the Math::Zap::Triangle manpage
the Math::Zap::Triangle2 manpage
the perlfunc manpage Perl built-in functions
PDL for scientific and bulk numeric data processing and display
the Math::Complex manpage, the Math::Trig manpage, the Math::Quaternion manpage, the Math::Vectors manpage
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.