Extreme Optimization > User's Guide > Mathematics Library > General Classes > Mathematical Constants

Extreme Optimization User's Guide

User's Guide

Up: General Classes Next: Elementary Functions Previous: Machine Constants Contents

Mathematical Constants

Many mathematical constants and expressions involving small integers occur time and again in numerical calculations. The Constants class contains static fields for many of these values.

The constants fall into four categories:

The following example shows a method that evaluates the probability density function of a normal distribution with mean mean and standard deviation stdDev.

C# CopyCode imageCopy Code
using Extreme.Mathematics;
public double NormalPDF(double x, double mean, double stdDev)
{
    double z = (x - mean) / stdDev;
    return Constants.OneOverSqrtTwoPi / stdDev
        * Math.Exp(-0.5*z*z);
}
Visual Basic CopyCode imageCopy Code
Imports Extreme.Mathematics
Public Function NormalPDF(x As Double, mean  As Double, stdDev  As Double)  As Double
    Dim z As Double = (x - mean) / stdDev
    Return Constants.OneOverSqrtTwoPi / stdDev _
        * Math.Exp(-0.5*z*z)
End Function

The tables below list the constants in each of the four categories.

Fundamental constants
E The base for the natural logarithm, e (2.718...).
EulersConstant Euler's constant, which is important in number theory and some engineering calculations (0.577...).
GoldenRatio The Golden Ratio (1.618...).
Pi The number Pi, the ratio between the circumference and the diameter of a circle (3.1415...).
Table 1. Fundamental constants.

Expressions Involving Fundamental Constants
TwoPi Two times Pi (6.283...).
PiOverTwo 0.5 times Pi (1.570...).
PiOverFour 0.25 times Pi (0.785...).
LogTwoPi The natural logarithm of two times Pi (1.837...).
PiSquared The square of Pi (9.869...).
SqrtPi The square root of Pi (1.772...).
SqrtTwoPi The square root of two times Pi (2.506...).
OneOverSqrtPi The reciprocal of the square root of Pi (0.564...).
OneOverSqrtTwoPi The reciprocal of the square root of two times Pi (0.399...).
Table 2. Expressions involving fundamental constants..

Square Roots of Small Integers
Sqrt2 The square root of two (1.414...).
Sqrt3 The square root of three (1.732...).
Sqrt5 The square root of five (2.236...).
Sqrt7 The square root of seven (2.646...).
Sqrt17 The square root of seventeen (4.123...).
Table 3. Square roots of small integers.

Logarithms of Small Integers
Log2 The natural logarithm of two (0.693...).
Log3 The natural logarithm of three (1.098...).
Log10 The natural logarithm of ten (2.305...).
Log17 The natural logarithm of seventeen (2.833...).
InvLog10 The base-10 logarithm of E.
Table 4. Logarithms of small integers.

Up: General Classes Next: Elementary Functions Previous: Machine Constants Contents

Overview
Introduction
Features
Documentation
QuickStart Samples
Sample Applications
Downloads
Get it now!
Download trial version
How to Buy
Information
Resources
Contact Us
Search

"The Extreme Optimization Statistics Library for .NET is a major boon for those doing statistical work in .NET. I strongly recommend this product."
- Marc Brooks

"I have made it my mission to institutionalize the value of good API design.  I strongly believe that this is key to making developers more productive and happy on our platform. It is clear that you value good API design in your work, and take to heart developer productivity and synergy with the .NET framework."
- Brad Abrams,
Lead Program Manager, Microsoft.

This is a partial list of companies who are using our libraries:
ABB Robotics
Allstate
Applied Materials
Arcam
Astra Schedule
Babson College
Canadian Council on Learning
Canyon Associates
Caxton Associates
CECity
Constellation Energy
CreditSights
DeepOcean
Duke University
Dynamotive
Elecsoft
Engelhard Corporation
Epcor
Equipoise Software
Galileo International
GAM UK
Gammex
GlaxoSmithKline
Global Matrix
The Hartford
Infinera Corporation
Intel
JDS Uniphase
LaBranche & Co.
Learning & Skills Council
Jacobs Consultancy
Litman Gregory
Lucas Systems
Malvern Instruments
Medrio
Merck & Co.
Mintera.
Monitor Software
MorningStar
NanoString Technologies
Paletta Invent
Parametric Portfolio Associates
Prosanos
RATA Associates
RiskShield
Ramboll
Standard & Poor's
Strategic Analysis Corporation
Univ. of Alicante
Univ. of South Carolina
vielife
Xerox
US Army