Index

AAbsAccuracyAllAlternativesAndAnyAnyNullSequenceAnySequenceApplyArCoshArCothArCschArSechArSinhArTanhArcCosArcCotArcCscArcSecArcSinArcTanArgAttributes

BBernoulliBinaryFormatBinomialBoole

CCalculateCeilClearClearAttributesComplementComplexComplexInfinityComplexOverflowComplexUnderflowCompoundConditionConjugateContainCosCoshCotCothCountCscCsch

DDefineDefineDelayedDefinitionsDenominatorDepthDigitBaseDirectedInfinityDivide

EEEndiannessEqualErfErfcEulerMascheroniExpExpandExpression

FFactorialFalseFibonacciFlatFlattenFloorFunction

GGoldenAngleGoldenRatioGreaterGreaterEqual

HHarmonicNumberHeadHoldAllHoldFirstHoldRest

IIIfImIndeterminateInfinityIntegerInternalFormIntersectionIsEvenIsInfiniteIsNumericIsOddIsOverflowIsPrimeIsUnderflowIterateIterateParallel

JJoin

KKernelIDKernels

LLaunchKernelsLengthLessLessEqualListListableLockedLog

MMachinePrecisionMapMapParallelMatchingMaxMinMinusMod

NNestNotNullNumerator

OOptionalOptionsOrOrderOrderlessOutputOverflow

PPartPartitionPatternPausePiPlusPowerPrecisionPrintProtected

QQuitKernels

RRandomRationalRationalizeReRealReplaceRoundRuleRuleDelayed

SSameScopeSecSechSelectSequenceSequenceHoldSetAttributesShiftLeftShiftRightSignSinSinhSlotSortSpanSplitSqrtStringSubDefineSubDefineDelayedSubtractSymbolSymbols

TTanTanhTimesTimingToIntegerToRealToStringToSymbolTrueTrunc

UUnderflowUnequalUnionUnsame

XXor

Absfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

Abs(z)
gives the absolute value of the (complex) number z.

Details

  • Abs is suitable for both symbolic and numerical manipulation.
  • If z is an exact numerical expression, the numerical estimation of z is used to decide about the sign.
  • For special cases of z, some simplifications are performed.
  • Abs has the attribute Listable.

Examples

Abs(-123)123

Abs(1.2 + 3.4*I)3.60555

Abs(3+4*I)5

Abs uses the numerical estimation of an expression to decide about the sign of the result.

Abs(Sin(4))-Sin(4)

-Sin(4) // Calculate0.756802

Simplifications are performed if possible.

Abs(-2*x)2*Abs(x)

Abs(x^3)Abs(x)^3

See also

Arg Sign

Accuracyfunction

Syntax

Accuracy(z)
gives the number of precise decimal digits right of the decimal point of the number z.

Details

Examples

Determine the number's accuracy:

Accuracy(123)Infinity

Accuracy(3/7)Infinity

Accuracy(3.14)14.4577

Accuracy(2.0e24)-9.34644

Accuracy(Overflow)-Infinity

Accuracy(1234567890123456.7890)4.0

Accuracy(4.0 + 3*I)14.3525

See also

Precision Realx MachinePrecision

Allconstant

Syntax

All
can be used to specifies all elements.

Details

  • All can usually be used in Part[…] to pick all element from a particular level.

Examples

Part( {{a1,a2}, {b1,b2}, {c1,c2}} , All, 1 ){a1, b1, c1}

{"Hello", "World!"}[All, 1]{"H", "W"}

See also

Part[…]

Alternatives|function

Syntax

Alternatives(pat1, pat2, … )pat1 | pat2 |
is a pattern object that represents any pattern pati during a pattern matching.

Details

  • Alternatives can be understand as an OR operation for pattern objects, similar to Or|| for logical and binary expressions.

Examples

Matching( b, a|b )True

Alternatives can be used for replacements:

Replace( {a, b, c, a, b, c} , a|b -> 0 ){0, 0, c, 0, 0, c}

A definition of a function which excepts only integer and rational numbers.

f( x?Rational | x?Integer ) := x^2; { f(2), f(1.0), f(1/2) }{4, f(1.0), 1/4}

See also

Pattern Condition/? Optional:

And&&function

Syntax

And(bool1, bool2, … )bool1 && bool2 &&
gives the logical AND of booli.
And(int1, int2, … )int1 && int2 &&
gives the binary AND of the integers inti.
And(str1, str2, … )str1 && str2 &&
gives the binary AND of the strings stri.

Details

Examples

True && FalseFalse

12 && 74

'BINARY' && 'abc''@@B'

And stops to evaluate its arguments if False occurs. In the following case the second Print is not evaluated.

(Print(1);True) && False && (Print(2);True)1False

Expressions which are evaluated into True will be erased.

2==2 && a==5 && b==10 && Truea == 5 && b == 10

See also

Or|| Xor!! Not! False True

Any?function

Syntax

Any?
is a pattern object that matches to any object.
Any(head)?head
matches to any object having the head head.

Details

Examples

Matching( f(123), Any )True

Matching( f(123), Any(f) )True

Any can used in rules for replacements.

Replace( { 1, 1.0, 1/2, 4 } , ?Integer -> x ){x, 1.0, 1/2, x}

Any can used in an assignment as a pattern for an argument.

f(?Real) = "real"; { f(1), f(1.0), f(2^0.5) }{f(1), "real", "real"}

Possible Issues

In functions like Plus+ and Times*, Any does not differ from other symbols and is transformed.

? + ? Matching( a + b, ? + ? ) Matching( a + b, x? + y? )2*Any
False
True

See also

AnySequence?? AnyNullSequence??? Pattern Head

AnyNullSequence???function

Syntax

AnyNullSequence???
is a pattern object that matches to a sequence of any objects, even an empty sequence of no object.
AnyNullSequence(head)???head
matches to a sequence of objects all having the head head, or an empty sequence.

Details

Examples

Matching( f(), f(AnyNullSequence) )True

Matching( f(x, y), f(AnyNullSequence(Symbol)) )True

Matching( f(), f(AnyNullSequence(Symbol)) )True

AnyNullSequence can used in an assignment as a pattern for a sequence of arguments.

f(???Real) = "reals or nothing"; { f(), f(1.0), f(1.0, 2.0), f(1) }{"reals or nothing", "reals or nothing", "reals or nothing", f(1)}

See also

Any? AnySequence?? Pattern Head

AnySequence??function

Syntax

AnySequence??
is a pattern object that matches to a sequence of any objects.
AnySequence(head)??head
matches to a sequence of objects all having the head head.

Details

Examples

Matching( f(1, 2, 3), f(AnySequence) )True

Matching( f(x, y), f(AnySequence(Symbol)) )True

AnySequence can used in an assignment as a pattern for a sequence of arguments.

f(??Real) = "reals"; { f(1), f(1.0), f(1.0, 2.0), f(1, 0.5) }{f(1), "reals", "reals", f(1, 0.5)}

See also

Any? AnyNullSequence??? Pattern Head

Apply@@function

Syntax

Apply(h, exp)h @@ exp
replaces the head of expression exp with h.

Details

  • After the new head is set, the whole expression is evaluated.

Examples

Apply(g, f(1, a, x))g(1, a, x)

Plus @@ {2, 3, 4}9

Apply(Times, a+b+c)a*b*c

f @@ (a+b)f(a, b)

Apply will process anonymous function as well:

Apply( #1^#2 & , {3, 2} )9

See also

Map/@ Nest Function& Head

ArcCosfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

ArcCos(z)
gives the arcus cosine of z.

Details

  • ArcCos gives an exact result when possible.
  • If z is an exact numerical value, ArcCos remains unevaluated if no exact solution was found.
  • ArcCos gives complex results when z is not real or |z| > 1.
  • ArcCos has the attribute Listable.

Examples

ArcCos(0.5)1.0472

Calculate(ArcCos(1/2), 70)1.047197551196597746154214461093167628065723133125035273658314864102605

ArcCos(1.2)0.622363*I

ArcCos(2.0+3.0*I)1.00014-1.98339*I

Particular arguments and their result:

ArcCos(-1)Pi

ArcCos(0)1/2*Pi

ArcCos(1/2)1/3*Pi

ArcCos(1)0

See also

Cos ArcSin ArcTan ArcSec ArCosh

ArcCotfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

ArcCot(z)
gives the arcus cotangent of z.

Details

  • ArcCot(z) = ArcTan(1/z).
  • ArcCot gives an exact result when possible.
  • If z is an exact numerical value, ArcCot remains unevaluated if no exact solution was found.
  • ArcCot has the attribute Listable.

Examples

ArcCot(2.0)0.463648

Calculate(ArcCot(2), 70)0.4636476090008061162142562314612144020285370542861202638109330887201979

ArcCot(2.0+3.0*I)0.160875-0.229073*I

Particular arguments and their result:

ArcCot(0)1/2*Pi

ArcCot(1)1/4*Pi

ArcCot(3^(1/2))1/6*Pi

ArcCot(Infinity)0

See also

Cot ArcCsc ArcSec ArcTan ArCoth

ArcCscfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

ArcCsc(z)
gives the arcus cosecant of z.

Details

  • ArcCsc(z) = ArcSin(1/z).
  • ArcCsc gives an exact result when possible.
  • If z is an exact numerical value, ArcCsc remains unevaluated if no exact solution was found.
  • ArcCsc gives complex results when z is not real or |z| < 1.
  • ArcCsc has the attribute Listable.

Examples

ArcCsc(3.0)0.339837

Calculate(ArcCsc(3), 70)0.3398369094541219370963925133917640663882446903324580714319239624899159

ArcCsc(0.2)1.5708-2.29243*I

ArcCsc(2.0+3.0*I)0.150386-0.231335*I

Particular arguments and their result:

ArcCsc(-1)-1/2*Pi

ArcCsc(0)ComplexInfinity

ArcCsc(2)1/6*Pi

ArcCsc(Infinity)0

See also

Csc ArcSec ArcCot ArcSin ArCsch

ArCoshfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

ArCosh(z)
gives the area hyperbolic cosine of z.

Details

  • ArCosh gives an exact result when possible.
  • If z is an exact numerical value, ArCosh remains unevaluated if no exact solution was found.
  • ArCosh gives complex results when z is not real or z < 1.
  • ArCosh has the attribute Listable.

Examples

ArCosh(1.5)0.962424

Calculate(ArCosh(3/2), 70)0.9624236501192068949955178268487368462703686687713210393220363376803277

ArCosh(0.2)1.36944*I

ArCosh(2.0+3.0*I)1.98339+1.00014*I

Particular arguments and their result:

ArCosh(1)0

ArCosh(-1)I*Pi

ArCosh(0)1/2*I*Pi

ArCosh(1/2)1/3*I*Pi

See also

Cosh ArSinh ArTanh ArSech ArcCos

ArCothfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

ArCoth(z)
gives the area hyperbolic cotangent of z.

Details

  • ArCoth(z) = ArTanh(1/z).
  • ArCoth gives an exact result when possible.
  • If z is an exact numerical value, ArCoth remains unevaluated if no exact solution was found.
  • ArCoth gives complex results when z is not real or |z| < 1.
  • ArCoth has the attribute Listable.

Examples

ArCoth(1.5)0.804719

Calculate(ArCoth(3/2), 70)0.8047189562170501873003796666130938197628006771342588609563239457370895

ArCoth(0.5)0.549306-1.5708*I

ArCoth(2.0+3.0*I)0.146947-0.231824*I

Particular arguments and their result:

ArCoth(0)Indeterminate

ArCoth(1)Infinity

ArCoth(Infinity)0

See also

Coth ArCsch ArSech ArTanh ArcCot

ArCschfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

ArCsch(z)
gives the area hyperbolic cosecant of z.

Details

  • ArCsch(z) = ArSinh(1/z).
  • ArCsch gives an exact result when possible.
  • If z is an exact numerical value, ArCsch remains unevaluated if no exact solution was found.
  • ArCsch has the attribute Listable.

Examples

ArCsch(0.5)1.44364

Calculate(ArCsch(1/2), 70)1.443635475178810342493276740273105269405553003156981558983054506520492

ArCsch(2.0+1.0*I)0.396568-0.186318*I

Particular arguments and their result:

ArCsch(0)ComplexInfinity

ArCsch(Infinity)0

See also

Csch ArSech ArCoth ArSinh ArcCsc

ArcSecfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

ArcSec(z)
gives the arcus secant of z.

Details

  • ArcSec(z) = ArcCos(1/z).
  • ArcSec gives an exact result when possible.
  • If z is an exact numerical value, ArcSec remains unevaluated if no exact solution was found.
  • ArcSec gives complex results when z is not real or |z| < 1.
  • ArcSec has the attribute Listable.

Examples

ArcSec(3.0)1.23096

Calculate(ArcSec(3), 70)1.230959417340774682134929178247987375710340009355094839055548333663992

ArcSec(0.2)2.29243*I

ArcSec(2.0+3.0*I)1.42041+0.231335*I

Particular arguments and their result:

ArcSec(-1)Pi

ArcSec(0)ComplexInfinity

ArcSec(2)1/3*Pi

ArcSec(Infinity)1/2*Pi

See also

Sec ArcCsc ArcCot ArcCos ArSech

ArcSinfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

ArcSin(z)
gives the arcus sine of z.

Details

  • ArcSin gives an exact result when possible.
  • If z is an exact numerical value, ArcSin remains unevaluated if no exact solution was found.
  • ArcSin gives complex results when z is not real or |z| > 1.
  • ArcSin has the attribute Listable.

Examples

ArcSin(0.5)0.523599

Calculate(ArcSin(1/2), 70)0.5235987755982988730771072305465838140328615665625176368291574320513027

ArcSin(1.2)1.5708-0.622363*I

ArcSin(2.0+3.0*I)0.570653+1.98339*I

Particular arguments and their result:

ArcSin(-1)-1/2*Pi

ArcSin(0)0

ArcSin(1/2)1/6*Pi

ArcSin(1)1/2*Pi

See also

Sin ArcCos ArcTan ArcCsc ArSinh

ArcTanfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

ArcTan(z)
gives the arcus tangent of z.
ArcTan(x,y)
gives the arcus tangent of y/x, taking into account the quadrant of the point (x, y).

Details

  • ArcTan gives an exact result when possible.
  • If z is an exact numerical value, ArcTan remains unevaluated if no exact solution was found.
  • ArcTan has the attribute Listable.

Examples

ArcTan(2.0)1.10715

Calculate(ArcTan(2), 70)1.107148717794090503017065460178537040070047645401432646676539207433710

ArcTan(2.0+3.0*I)1.40992+0.229073*I

Particular arguments and their result:

ArcTan(0)0

ArcTan(1)1/4*Pi

ArcTan(3^(1/2))1/3*Pi

ArcTan(Infinity)1/2*Pi

ArcTan with two arguments:

ArcTan(1, 1)1/4*Pi

ArcTan(-1, 0)Pi

ArcTan(-1.0, -3.0)-1.89255

ArcTan(-2, 1)Pi - ArcTan(1/2)

See also

Tan ArcSin ArcCos ArcCot ArTanh

Argfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

Arg(z)
gives the argument of the (complex) number z.

Details

  • Arg is suitable for both symbolic and numerical manipulation.
  • Arg gives the phase angle in radians between -Pi and Pi.
  • Arg is 0 for positive non-complex numbers, and Pi for negative non-complex numbers.
  • Arg(0) is 0.
  • For special cases of z, some simplifications are performed.

Examples

Arg(1.2 + 3.4*I)1.2315

Arg(-123)Pi

Arg(1+I)1/4*Pi

Arg(2.5)0

Simplifications are performed if possible.

Arg(-2*x)Arg(-x)

Arg(x^(1/3))1/3*Arg(x)

Arg(Abs(z))0

See also

Abs Sign

ArSechfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

ArSech(z)
gives the area hyperbolic secant of z.

Details

  • ArSech(z) = ArCosh(1/z).
  • ArSech gives an exact result when possible.
  • If z is an exact numerical value, ArSech remains unevaluated if no exact solution was found.
  • ArSech gives complex results when z is not real or z < 0 or z > 1.
  • ArSech has the attribute Listable.

Examples

ArSech(0.5)1.31696

Calculate(ArSech(1/2), 70)1.316957896924816708625046347307968444026981971467516479768472256920460

ArSech(1.5)0.841069*I

ArSech(2.0+1.0*I)0.215612-1.16921*I

Particular arguments and their result:

ArSech(0)Infinity

ArSech(1)0

ArSech(2)1/3*I*Pi

ArSech(Infinity)1/2*I*Pi

See also

Sech ArCsch ArCoth ArCosh ArcSec

ArSinhfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

ArSinh(z)
gives the area hyperbolic sine of z.

Details

  • ArSinh gives an exact result when possible.
  • If z is an exact numerical value, ArSinh remains unevaluated if no exact solution was found.
  • ArSinh gives complex results when z is not real.
  • ArSinh has the attribute Listable.

Examples

ArSinh(1.5)1.19476

Calculate(ArSinh(3/2), 70)1.194763217287109304111930828519090523536162075153005429270680299461324

ArSinh(2.0+3.0*I)1.96864+0.964659*I

Particular arguments and their result:

ArSinh(0)0

ArSinh(1*I)1/2*I*Pi

ArSinh(1/2*I)1/6*I*Pi

See also

Sinh ArCosh ArTanh ArcCsch ArcSin

ArTanhfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

ArTanh(z)
gives the area hyperbolic tangent of z.

Details

  • ArTanh gives an exact result when possible.
  • If z is an exact numerical value, ArTanh remains unevaluated if no exact solution was found.
  • ArTanh gives complex results when z is not real or |z| > 1.
  • ArTanh has the attribute Listable.

Examples

ArTanh(0.5)0.549306

Calculate(ArTanh(1/2), 70)0.5493061443340548456976226184612628523237452789113747258673471668187471

ArTanh(1.5)0.804719-1.5708*I

ArTanh(2.0+3.0*I)0.146947+1.33897*I

Particular arguments and their result:

ArTanh(0)0

ArTanh(1)Infinity

ArTanh(I)1/4*I*Pi

ArTanh(-Infinity)1/2*I*Pi

See also

Tanh ArSinh ArCosh ArCoth ArcTan

Attributesfunction

Syntax

Attributes(s)
gives a list of all set attributes for symbol s.
Attributes(s) = attr
sets the attribute attr for symbol s.
Attributes(s) = {attr1, attr2, …}
sets the attributes attri for symbol s.

Details

  • During the set of attributes all old attributes are removed.
  • The following set of attributes can be used for a symbol f:
    Flat f is associative.
    Orderless f is commutative.
    Listable f is automatically threaded over List{…}.
    Protected Definitions of f cannot be changed.
    Locked Attributes of f cannot be changed.
    HoldAll All argument of f maintain unevaluated.
    HoldFirst The first argument of f maintains unevaluated.
    HoldRest All argument of f, except the first one, maintain unevaluated.
    SequenceHold An expicit Sequence as an argument of f maintains unevaluated.

Examples

Attributes(Plus){Flat, Listable, Locked, NumericFunction, OneIdentity, Orderless, Protected}

Define an orderless and flat expression:

f(1, z, f(a, 2))f(1, z, f(a, 2))

Attributes(f) = {Orderless, Flat}{Flat, Orderless}

f(1, z, f(a, 2))f(1, 2, a, z)

Define a function that threads over lists:

Attributes(g) = Listable; g(x?) := "<" ~ ToString(x) ~ ">"

g(7)"<7>"

g({-1,2,a}){"<-1>", "<2>", "<a>"}

See also

Flat Orderless Protected Locked Listable

Bernoullifunction

Syntax

Bernoulli(n)
gives the Bernoulli number Bn.

Details

  • The evaluation of Bn uses a summation series by Braun–Romberger–Bentz.
  • Bernoulli has the attribute Listable.

Examples

Bernoulli(2)1/6

Bernoulli(10)5/66

Bernoulli(60)-1215233140483755572040304994079820246041491/56786730

Possible Issues

Bernoulli is left unevaluated for non-integer or negative numbers.

Bernoulli(-2)Bernoulli(-2)

Bernoulli(3.5)Bernoulli(3.5)

See also

Binomial

Reference

BinaryFormatoption

Syntax

BinaryFormat -> type
is an option to define the binary format for numeric and string representations.

Details

  • BinaryFormat can be used in ToString, ToInteger, and ToReal.
  • type is a string and can be one of the following formats:
    Integer formats:
    "Integer8", "int8" 8-bit signed integer
    "Integer16", "int16" 16-bit signed integer 1)
    "Integer32", "int32" 32-bit signed integer 1)
    "Integer64", "int64" 64-bit signed integer 1)
    "IntegerN", "intn" n-bit signed integer 1) 2)
    "UnsignedInteger8", "uint8" 8-bit unsigned integer
    "UnsignedInteger16", "uint16" 16-bit unsigned integer 1)
    "UnsignedInteger32", "uint32" 32-bit unsigned integer 1)
    "UnsignedInteger64", "uint64" 64-bit unsigned integer 1)
    "UnsignedIntegerN", "uintn" n-bit unsigned integer 1) 2)
    Floating-point formats:
    "Real16", "float16", "half" 16-bit IEEE 754 floating point number
    "Real32", "float32", "single" 32-bit IEEE 754 floating point number
    "Real64", "float64", "double" 64-bit IEEE 754 floating point number
    "Complex32" Two 16-bit IEEE 754 floating point numbers
    "Complex64" Two 32-bit IEEE 754 floating point numbers
    "Complex128" Two 64-bit IEEE 754 floating point numbers
    String formats:
    "ANSI" Windows codepage 1252 - latin 1 encoded string
    "UTF8" UTF-8 encoded string
    "UTF16" UTF-16 encoded string 1)
    "UTF32" UTF-32 encoded string 1)
    1) By default the order of bytes are handled as little-endian. Use Endianness to change it.
    2) The size depends on the most significant bit and is rounded to a full byte.

Examples

Handling different number formats:

ToString(12345, BinaryFormat->"Integer16") ToString(3.1415, BinaryFormat->"double")'90' 'o\x12\x83ÀÊ!\t@'

ToInteger('ÿ', BinaryFormat->"Integer8") ToInteger('ÿ', BinaryFormat->"UnsignedInteger8")-1 255

Handling different string formats:

ToString("yä€𝄞", BinaryFormat->"ANSI") ToString("yä€𝄞", BinaryFormat->"UTF8") ToString("yä€𝄞", BinaryFormat->"UTF16", Endianness->-1) ToString("yä€𝄞", BinaryFormat->"UTF16", Endianness->1) ToString("yä€𝄞", BinaryFormat->"UTF32")'yä\x80?' 'yäâ\x82¬ð\x9D\x84\x9E' 'y\0ä\0¬ 4Ø\x1EÝ' '\0y\0ä ¬Ø4Ý\x1E' 'y\0\0\0ä\0\0\0¬ \0\0\x1EÑ\x01\0'

ToString('yäâ\x82¬ð\x9D\x84\x9E', BinaryFormat->"UTF8") ToString('\0y\0ä ¬Ø4Ý\x1E', BinaryFormat->"UTF16", Endianness->1)"yä€𝄞" "yä€𝄞"

Possible Issues

An error is given, if the format is insufficient for the whole number or its precision.

ToString(12345, BinaryFormat->"Integer8") ToString(12345, BinaryFormat->"float16")ToString.InsufficientBinaryFormat: Specified format Integer8 is insufficient to represent the whole number 12345 or its precision.ToString.InsufficientBinaryFormat: Specified format float16 is insufficient to represent the whole number 12345 or its precision.'9' '\ar'

ToReal('\ar', BinaryFormat->"float16")12344.0

See also

ToString ToInteger ToReal Endianness

Binomialfunction

Syntax

Binomial(n, k)
gives the binomial coefficient n choose k.

Details

Examples

Binomial(49, 6)13983816

Binomial(365, 31)884481797664650696626118102000059032909354320

Binomial(7/2, 3/2)35/8

Binomial(3.5, 2.1)4.26099

Binomial keeps partial products as small as possible to avoid overflows.

(10^20)!Integer.Overflow: Integer overflow during computation with integers detected.Overflow

Binomial(10^20, 3)166666666666666666661666666666666666666700000000000000000000

See also

Factorial!

Boolefunction

Syntax

Boole(bool)
gives 0 if bool is True and 1 if bool is False.

Details

Examples

Boole(False)0

Boole(32 > 30)1

Boole(a<b)Boole(a < b)

Boole({True, False, False}){1, 0, 0}

See also

False True If

Calculatefunction

Syntax

Calculate(exp)
evaluates the expression exp to a real or complex number with machine precision.
Calculate(exp, n)
evaluates the expression exp to a real or complex number with precision n.

Details

  • Usually, expressions with exclusively exact values, will keep exact results.
    Use Calculate to receive an approximate numerical value of them.
  • Calculate, with a specified precision n, uses internally a higher precision to ensure the required precision of the result.
  • Calculate do not affect the exponent of Power^ to keep fast evaluation of rational powers still possible.

Examples

Log(-5)I*Pi + Log(5)

Log(-5) // Calculate1.60944+3.14159*I

Calculate a set of expressions:

x = { 4/6 , Cos(3) , Cos(Pi/6) }{2/3, Cos(3), 1/2*3^(1/2)}

Calculate(x){0.666667, -0.989992, 0.866025}

Calculate any exact expressions with a specified precision:

Calculate(Log(-5), 25)1.609437912434100374600759+3.141592653589793238462643*I

Calculate(Cos(2^10), 50)0.98735361821984829524651338092244419111051208085007

Possible Issues

It is not possible to increase the precision of an inexact number:

x = Calculate(Pi, 15)3.14159265358979

Calculate(x, 30)3.14159265358979

In some cases the internally higher precision is not enough to ensure the required precision of the result:

y = Calculate(Sin(10^40), 30)Calculate.ExtraPrecisionLimit: Internal extra precision limit (32) reached during calculation.-0.569633400953636327308

y // Precision21.6803

A subtraction of almost equal numbers can can lead to strong loss of precision.

Calculate(Exp(1/10^100)-1, 30)Calculate.ExtraPrecisionLimit: Internal extra precision limit (32) reached during calculation.0.e-61

The exponent of Power^ is not affected by Calculate, the base is affected.

Calculate(z^4)z^4

Calculate(Pi^z)3.14159^z

See also

Precision MachinePrecision Realx Complexx+y*I

Ceilfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

Ceil(x)
gives the smallest integer greater than or equal to x.

Details

  • If x is an exact numerical expression, the numerical approximation of x is used to establish the result.
  • For a complex number x, Ceil is applied separately to the real and imaginary part.
  • Ceil has the attribute Listable.

Examples

Ceil(2.1)3

Ceil(-2.9)-2

Ceil(3/8)1

Ceil(1.2 + 3.8*I)2+4*I

Ceil(Log(10))3

Ceil(Pi*10^50)314159265358979323846264338327950288419716939937511

Processing of Overflow and Underflow:

Ceil(Overflow)Overflow

Ceil(Underflow)1

Ceil(-Underflow)0

See also

Floor Trunc Round

Clearfunction

Syntax

Clear(s)
removes all assignment rule defined to symbol s.
Clear({s1, s2, … })
removes all assignment rule defined to the symbols si.

Details

Examples

Remove an assignment from a single symbols:

x = 123123

x^215129

Clear(x)

x^2x^2

Remove all assignments:

f(10) = 0 f(z?Integer) := 2*z f(z?) * w? @:= -w*z0

Definitions(f)f(10) = 0f(Pattern(z, ?Integer)) := 2*zf(Pattern(z, Any))*Pattern(w, Any) @:= Minus(w*z)

Clear(f)

Definitions(f)/* no definitions */

See also

Define= DefineDelayed:= SubDefine@= SubDefineDelayed@:=

ClearAttributesfunction

Syntax

ClearAttributes(s)
removes all attributes for symbol s.
ClearAttributes(s, attr)
removes the attribute attr for symbol s.
ClearAttributes(s, {attr1, attr2, … } )
removes the attributes attri for symbol s.

Details

Examples

Remove the attribute Listable of Boole:

Boole({True, False, True}){1, 0, 1}

ClearAttributes(Boole, Listable){Listable}

Boole({True, False, True})Boole({True, False, True})

However, Boole has still other attributes:

Attributes(Boole){Protected}

Possible Issues

Attributes of locked symbols can't be removed.

ClearAttributes(Plus)Attributes.Locked: Plus is locked!{}

See also

Attributes SetAttributes

Complementfunction

Syntax

Complement(list, list1, list2, … )
gives a sorted list of all distinct elements that appear in list but not in any of listi.

Details

  • If the lists list and listi are considered as sets, Complement gives their complement list \ list1.
  • Complement works with any kind of expressions as long as they have the same head.

Examples

Complement( {4,2,3,2,1} , {1,4} ){2, 3}

Complement( {x, y, z} , {y} ){x, z}

Complement( {1,2,3,4} , {1,2} , {2,3} ){4}

Complement works with any expressions, not only lists, as long as they have the same head.

Complement( a + b + c + d , a + c )b + d

Complement( f(1, 4, 2), f(2, 3) )f(1, 4)

Possible Issues

Heads have to be the same when Complement is applied on expressions.

Complement( f(1, 4, 2), g(2, 3) )Complement.Heads: Heads f and g are not the same.Complement(f(1, 4, 2), g(2, 3))

See also

Union Intersection Join~

Complexx+y*Iobject

Syntax

Complex(x, y)x + y*I
is a complex number with a real part x and imaginary part y multiplied with the imaginary unit I.
Complex
is the head of a complex number.

Details

  • Both parts x and y can be of the type Integern, Rationala/b or Realx.
  • Complex numbers are exact numbers as long as both parts are exact numbers.
  • If either the real part or the imaginary part is an inexact number, the other part is not effected by this inaccuracy.
  • ComplexOverflow and ComplexUnderflow are two special complex numbers representing a float pointing overflow or underflow, respectively.

Examples

1+2*I1+2*I

Complex(1,2)1+2*I

Head(1+2*I)Complex

(1-I)^3-2-2*I

1/2 + 0.4*I1/2+0.4*I

Many functions can handle and return complex numbers:

Sqrt(-4)2*I

Log(-0.5)-0.693147+3.14159*I

Exp(1+1.5*I)0.192284+2.71147*I

Abs(3+4*I)5

Possible Issues

Combinations of ComplexOverflow and ComplexUnderflow can result in Indeterminate.

ComplexOverflow * ComplexUnderflowIndeterminate

See also

I Integern Rationala/b Realx

ComplexInfinityconstant

Syntax

ComplexInfinity
represents the mathematical infinite quantity with an undetermined complex phase.

Details

Examples

Abs(ComplexInfinity) > Abs(ComplexOverflow)True

Arithmetical and mathematical functions are able to process ComplexInfinity:

1 / ComplexInfinity0

1 / 0ComplexInfinity

Log(ComplexInfinity)Infinity

See also

DirectedInfinity Infinity ComplexOverflow IsInfinite

ComplexOverflowconstant

Syntax

ComplexOverflow
represents an overflow in float-pointing arithmetic with complex numbers.

Details

Examples

(7.0+4.0*I) ^ Exp(100.0)ComplexOverflow

Arithmetical and mathematical functions are able to process ComplexOverflow:

3.14 + ComplexOverflowComplexOverflow

ComplexOverflow * (-2)ComplexOverflow

Abs( ComplexOverflow )Overflow

Arg( ComplexOverflow )Indeterminate

See also

ComplexUnderflow Overflow ComplexInfinity IsOverflow

ComplexUnderflowconstant

Syntax

ComplexUnderflow
represents an underflow in float-pointing arithmetic with complex numbers.

Details

Examples

(7.0+4.0*I) ^ (-Exp(100.0))ComplexUnderflow

Arithmetical and mathematical functions are able to process ComplexUnderflow:

3.14 + ComplexUnderflow3.14+0.0*I

ComplexUnderflow * (-2)ComplexUnderflow

1 / ComplexUnderflowComplexOverflow

Abs( ComplexUnderflow )Underflow

Arg( ComplexUnderflow )Indeterminate

See also

ComplexOverflow Underflow IsUnderflow

Compound;function

Syntax

Compound(exp1, exp2, … )exp1 ; exp2 ;
evaluates all expressions expi in turn and gives the last one as result.
exp;
evaluates exp but gives Null as result.

Details

Examples

x = 1 ; y = 2 ; x + y3

z = 10^10000;

Log(10, z)10000

See also

Null Print

Condition/?function

Syntax

Condition(pat, cond)pat /? cond
is a pattern object that matches only if the evaluation of cond yields True.

Details

  • The condition is only evaluated if the pattern pat matches at all.
  • Condition can be applied to a single pattern object or to a whole expression.
  • In a collection of definitions, the next definition is tried if cond yields not True.
    That distinguishes the use of Condition/? instead of If.

Examples

Matching( 1, x? /? x>0 ) Matching( -1, x? /? x>0 )True
False

Using Condition in a single argument:

f(x? /? x!=0) := 1/x

f(2) f(1/2) f(0)1/2 2 f(0)

Using Condition for the whole definition:

g(x?, y?) /? x>y := x^y

g(10, 2) g(2, 4) g(x, 3)100 g(2, 4) g(x, 3)

Using Condition for a replacement rule:

Replace( {-1,2,-3,4,-5,6} , x?Integer /? x<0 -> 0 ){0, 2, 0, 4, 0, 6}

The difference between a definition with Condition/? instead of a definition with If:

g( x? /? x!=1 ) := (x^2-1)/(x-1) /* general definition with exception */ h(x?) := If( x!=1 , (x^2-1)/(x-1) , "problem" ) /* definition with If */

{ g(0.0) , g(1.0) , g(2.0) } { h(0.0) , h(1.0) , h(2.0) }{1.0, g(1.0), 3.0} {1.0, "problem", 3.0}

See also

Pattern Alternatives| Optional: If

Conjugatefunction

Syntax

Conjugate(z)
gives the complex conjugate of the complex number z.

Details

  • Conjugate flips the sign of the imaginary part.
  • Conjugate has the attribute Listable.
  • For special cases of z, some simplifications are performed.

Examples

Conjugate(1+I)1-I

Conjugate(1.2 - 3.4*I)1.2+3.4*I

Conjugate(-123)-123

Conjugate(I*Infinity)DirectedInfinity(-I)

Simplifications are performed if possible.

Conjugate(-2*x)-2*Conjugate(x)

Conjugate(Log(3+I))Log(3-I)

Conjugate((-2)^(1/2))-I*2^(1/2)

See also

Abs Arg Re Im

Containfunction

Syntax

Contain(exp, el)
gives True if exp contains el at any level, and False otherwise.

Details

Examples

Working with lists:

Contain( {1,2,3,4,5} , 3 ) Contain( {1,2,3,4,5} , 6 )True
False

Contain( {1, 2, {31, 32}, 4} , 31 )True

Contain( {1, Pi, 4.5, f()} , ?Real)True

Working with expressions:

Contain( 3+4*x^2, x)True

Contain( 2 + 2*x + 3*x^2 , Condition(x^y?, y>3) ) Contain( 2 + 2*x + 3*x^2 - 5*x^4 , Condition(x^y?, y>3) )False
True

See also

Count Matching Pattern Condition/?

Cosfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

Cos(z)
gives the cosine of z.

Details

  • Cos gives an exact result when possible.
  • If z is an exact numerical value, Cos remains unevaluated if no exact solution was found.
  • z is assumed to be in radians.
  • Cos has the attribute Listable.

Examples

Cos(2.0)-0.416147

Calculate(Cos(2), 70)-0.4161468365471423869975682295007621897660007710755448907551499737819649

Cos(2.0+3.0*I)-4.18963-9.10923*I

Particular arguments and their result:

Cos(0)1

Cos(Pi/2)0

Cos(Pi/3)1/2

Cos(Pi/4)1/2^(1/2)

Pure imaginary arguments are converted into Cosh:

Cos(2*I)Cosh(2)

The cosine of the arcus cosine is identity:

Cos(ArcCos(z))z

See also

ArcCos Sin Tan Sec Cosh

Coshfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

Cosh(z)
gives the hyperbolic cosine of z.

Details

  • Cosh gives an exact result when possible.
  • If z is an exact numerical value, Cosh remains unevaluated if no exact solution was found.
  • Cosh has the attribute Listable.

Examples

Cosh(2.0)3.7622

Calculate(Cosh(2), 70)3.762195691083631459562213477773746108293973558230711602777643347588324

Cosh(2.0+3.0*I)-3.72455+0.511823*I

Particular arguments and their result:

Cosh(0)1

Pure imaginary arguments are converted into Cos:

Cosh(2*I)Cos(2)

The hyperbolic cosine of the area hyperbolic cosine is identity:

Cosh(ArCosh(z))z

See also

ArCosh Sinh Tanh Sech Cos

Cotfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

Cot(z)
gives the cotangent of z.

Details

  • Cot(z) = 1 / Tan(z).
  • Cot gives an exact result when possible.
  • If z is an exact numerical value, Cot remains unevaluated if no exact solution was found.
  • z is assumed to be in radians.
  • Cot has the attribute Listable.

Examples

Cot(2.0)-0.457658

Calculate(Cot(2), 70)-0.4576575543602857637502774104320472764284863292316743296413921626362923

Cot(2.0+3.0*I)-0.00373971-0.996758*I

Particular arguments and their result:

Cot(0)ComplexInfinity

Cot(Pi/2)0

Cot(Pi/3)1/3^(1/2)

Cot(Pi/4)1

The tangent of the arcus tangent is identity:

Cot(ArcCot(z))z

See also

ArcCot Csc Sec Tan Coth

Cothfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

Coth(z)
gives the hyperbolic cotangent of z.

Details

  • Coth(z) = 1 / Tanh(z).
  • Coth gives an exact result when possible.
  • If z is an exact numerical value, Coth remains unevaluated if no exact solution was found.
  • Coth has the attribute Listable.

Examples

Coth(1.0)1.31304

Calculate(Coth(1), 70)1.313035285499331303636161246930847832912013941240452655543152967567084

Coth(1.0+2.0*I)0.82133+0.171384*I

Particular arguments and their result:

Coth(0)ComplexInfinity

Coth(Infinity)1

The hyperbolic cotangent of the area hyperbolic cotangent is identity:

Coth(ArCoth(z))z

See also

ArCoth Csch Sech Tanh Cot

Countfunction

Syntax

Count(exp, el)
gives the number of elements in exp that match el.
Count(str, sr)
gives the number of sr occurring in str.

Details

  • Usually, exp is a List{…} and Count gives the nummer of members matching el.
  • However, exp can any kind of expression and el can be a pattern object as well.
  • If only the presence have to be checked, instead of exact number of ocurres, Contain is faster than Count.

Examples

Working with lists:

Count( {1, 0, 0, 1, 0} , 1 )2

Count( {a, x, {b, x}, x, c} , x )3

Count( {1, Pi, 4.5, f(), 2.0} , ?Real)2

Working with expressions:

Count( 3+3*x+4*x^2, x)2

Count( 2 + 2*x + 3*x^2 , x^y?)1

Working with strings:

Count( "foobaabaabaafoofoobaa", "baa")4

Count( 'ABAABABAA', 'A')6

Possible Issues

Count uses Matching for comparison and no mathematically equallity.

Count( {2.0, 2.0, 3.0} , 2 ) Count( {2.0, 2.0, 3.0} , 2.0 )0 2

See also

Contain Matching Pattern

Cscfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

Csc(z)
gives the cosecant of z.

Details

  • Csc(z) = 1 / Sin(z).
  • Csc gives an exact result when possible.
  • If z is an exact numerical value, Csc remains unevaluated if no exact solution was found.
  • z is assumed to be in radians.
  • Csc has the attribute Listable.

Examples

Csc(2.0)1.09975

Calculate(Csc(2), 70)1.099750170294616466756697397026312896658764443149845708742554443062569

Csc(2.0+3.0*I)0.0904732+0.041201*I

Particular arguments and their result:

Csc(0)ComplexInfinity

Csc(Pi/2)1

Csc(Pi/3)2/3^(1/2)

Csc(Pi/4)1/2^(1/2)

The tangent of the arcus tangent is identity:

Csc(ArcCsc(z))z

See also

ArcCsc Sec Cot Sin Csch

Cschfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

Csch(z)
gives the hyperbolic cosecant of z.

Details

  • Csch(z) = 1 / Sinh(z).
  • Csch gives an exact result when possible.
  • If z is an exact numerical value, Csch remains unevaluated if no exact solution was found.
  • Csch has the attribute Listable.

Examples

Csch(2.0)0.275721

Calculate(Csch(2), 70)0.2757205647717832077583514821630271212496226719912580519731712337225655

Csch(2.0+3.0*I)-0.272549-0.0403006*I

Particular arguments and their result:

Csch(0)ComplexInfinity

Csch(Infinity)0

The hyperbolic secant of the area hyperbolic secant is identity:

Csch(ArCsch(z))z

See also

ArCsch Sech Coth Sinh Csc

Define=function

Syntax

Define(lhs, rhs)lhs = rhs
evaluates the expression rhs and assign the result as a replacement for the expression lhs whenever it appears.

Details

  • lhs is typically a symbol or an expression with pattern objects.
  • For Define the assignment f(g) = rhs is associate with f, while f(g) @= rhs (SubDefine@=) is associate with g.
  • The expression rhs will evaluated before assignment.
  • Multiple assignments to the same expression head are ordered by their specialization.
  • If lhs and rhs are lists with same length, the assignment is done with corresponding elements.
  • lhs can contain Condition/? to specialize the definition.
  • Clear can be used to remove all assignment rules from a symbol.

Examples

Assign expressions to single symbols:

x = 123123

x*2246

y = a^2 + b^2a^2 + b^2

2*y2*(a^2 + b^2)

Multiple assignments via list:

{a, b, c} = {123, 3.14, "Test"};

a b c123 3.14 "Test"

Assign expressions to an expression with a pattern:

f(z?) = z^2 + zz + z^2

f(9) f(a+b)90 16037.4

Polytypism allows multiple definitions to the same expression head:

f(z?, n?) = z^n + zz + z^n

f(w) f(w, 5)w + w^2 w + w^5

Possible Issues

Define evaluates the expression rhs on the right hand side before assignment, DefineDelayed:= not.

x = 3.143.14

h(x?) = 2*x6.28

k(x?) := 2*x

x is already known and will be replaced in Define= but not in DefineDelayed:=.

h(123) k(123)6.28 246

See also

DefineDelayed:= SubDefine@= Clear Pattern Expressionf(…) Symbols

DefineDelayed:=function

Syntax

DefineDelayed(lhs, rhs)lhs := rhs
assigns the unevaluated expression rhs as a replacement for the expression lhs whenever it appears.

Details

  • lhs is typically a symbol or an expression with pattern objects.
  • For DefineDelayed the assignment f(g) := rhs is associate with f, while f(g) @:= rhs (SubDefineDelayed@:=) is associate with g.
  • The expression rhs will assigned unevaluated and is always evaluated when lhs is called.
  • Multiple assignments to the same expression head are ordered by their specialization.
  • If lhs and rhs are lists with same length, the assignment is done with corresponding elements.
  • lhs can contain Condition/? to specialize the definition.
  • Clear can be used to remove all assignment rules from a symbol.

Examples

Assign expressions to single symbols:

x := 123

x*2246

y := a^2 + b^2

2*y2*(a^2 + b^2)

Multiple assignments via list:

{a, b, c} := {123, 3.14, "Test"}

a b c123 3.14 "Test"

Assign expressions to an expression with a pattern:

f(z?) := z^2 + z

f(9) f(a+b)90 16037.4

Polytypism allows multiple definitions to the same expression head:

f(z?, n?) := z^n + z

f(w) f(w, 5)w + w^2 w + w^5

Possible Issues

DefineDelayed does not evaluates the expression rhs on the right hand side before assignment, Define= does.

m = 22

k(q?) := m*q

h(q?) = m*q2*q

m is already known and will be replaced within Define= during the assignment but for DefineDelayed:= after replacement.

h(a) k(a)246 246

The result of h(a) changes when m is changed, but not the result of k(a)

m = 55

h(123) k(123)246 615

See also

Define= SubDefineDelayed@:= Clear Pattern Expressionf(…) Symbols

Definitionsfunction

Syntax

Definitions(s)
prints all assignments defined to symbol s.

Details

  • For built-in functions just the assignment pattern is printed.
  • The definitions are printed in order of their specialization, started with the most specialized one.

Examples

Definitions(Plus)Plus(AnyNullSequence) /* built-in function */

Define some assignments to f and print all definitions:

f(1) = 1; f(x?) := f(x-1)+f(x-2); f(2) = 1; f(x? /? x <= 0) = 0;

Definitions(f)f(1) = 1f(2) = 1f(Condition(Pattern(x, Any), x <= 0)) = 0f(Pattern(x, Any)) := f(x - 1) + f(x - 2)

See also

Attributes Define= DefineDelayed:= SubDefine@= SubDefineDelayed@:=

Denominatorfunction

Syntax

Denominator(z)
gives the denominator of the number z.

Details

Examples

Denominator(3/7)7

Denominator(-8/3)3

Denominator(123)1

Denominator(3.4)1

Denominator(1/2 + 1/3*I)6

Denominator(f/g)g

Denominator(a^2*b^(-3)*c^4)b^3

See also

Numerator Rationala/b

Depthfunction

Syntax

Depth(exp)
gives the maximum nesting depth of exp.

Details

  • For a non-expression objects, Depth is 0.

Examples

Depth( { {1,2}, 3, {4,{5,6}} } )3

Depth( 123 )0

Depth works with any expressions, not only lists.

Depth( f(x^2) )2

Depth( a + 2*b^2 + 3*c )3

Rational and complex numbers have a depth of 0.

Depth( 1/3 )0

Depth( 1+2*I )0

Possible Issues

Depth operates on the internal evaluated form, not on the displayed form.

a/b Depth( a/b )a/b 2

InternalForm( a/b )Times(a, Power(b, -1))

See also

Length Part[…] Expressionf(…)

DigitBaseoption

Syntax

DigitBase -> int
is an option to define the digit base for number representations.

Details

  • DigitBase can be used in ToString, ToInteger, and ToReal.
  • int has to be an integer between 2 and 36.
  • If DigitBase is not explicitly specified, the base 10 is used.
  • For bases larger than ten, the capital letters from A until Z are used.
  • During parsing also the small letters from a until z are valid.

Examples

ToString(12345, DigitBase->2)"11000000111001"

ToString(10^100, DigitBase->36)"2HQBCZU2OW52BALA8LGC3S5Y9MM5TIY0VO9TKE25466GFI6AX8GS22X7KUU8L1TDS"

ToInteger("FF", DigitBase->16)255

ToInteger("5yc1s", DigitBase->36)10000000

ToReal("0.C4", DigitBase->16)0.765625

See also

ToString ToInteger ToReal BinaryFormat

DirectedInfinityfunction

Syntax

DirectedInfinity()
represents the mathematical infinite quantity with an unknown direction in the complex plane.
DirectedInfinity(z)
represents the mathematical infinite quantity with its direction in the complex plane along z.

Details

Examples

Arithmetical and mathematical functions are able to process DirectedInfinity:

DirectedInfinity(1.0+I) * DirectedInfinity(I)DirectedInfinity(-0.707107+0.707107*I)

DirectedInfinity(I) ^ 4Infinity

Tan(DirectedInfinity(1+I))I

ArcCos(Infinity)DirectedInfinity(I)

ArTanh(DirectedInfinity(I))1/2*I*Pi

See also

Infinity ComplexInfinity IsInfinite

Divide/function

Syntax

Divide(exp1, exp2)exp1 / exp2
divides expression exp1 by exp2.

Details

Examples

4 / 22

x^5 / x^2x^3

Possible Issues

A division of two exact numbers keeps exact. Use at least one real number to force a real result.

4 / 6 4.0 / 62/3 0.666667

See also

Times* Mod Power^

Econstant

Syntax

E
represents Euler's number e ≅ 2.71828.

Details

  • E is exact and is not evaluated unless it is combined with an inexact computation.
  • E can be calculated with arbitrary precision.
  • For calculations with an arbitrary precision the factorial series is used.

Examples

Calculate E:

Calculate(E)2.71828

Calculate(E, 70)2.718281828459045235360287471352662497757247093699959574966967627724077

Arithmetic with E:

2*E + 3*E5*E

2.0*E5.43656

Some functions give exact results for terms with E.

Log(E)1

See also

I Pi Calculate Exp Log

Endiannessoption

Syntax

Endianness -> -1Endianness -> 1
is an option to define the endianness (order of bytes) as little-endian (-1) or big-endian (1).

Details

Examples

ToString(1023, BinaryFormat->"Integer32") ToString(1023, BinaryFormat->"Integer32", Endianness->-1) ToString(1023, BinaryFormat->"Integer32", Endianness->1)'ÿ\x03\0\0' 'ÿ\x03\0\0' '\0\0\x03ÿ'

ToString("yä€𝄞", BinaryFormat->"UTF16", Endianness->-1) ToString("yä€𝄞", BinaryFormat->"UTF16", Endianness->1)'y\0ä\0¬ 4Ø\x1EÝ' '\0y\0ä ¬Ø4Ý\x1E'

ToInteger('ÿ\x01\0\0', BinaryFormat->"Integer32") ToInteger('ÿ\x01\0\0', BinaryFormat->"Integer32", Endianness->-1) ToInteger('ÿ\x01\0\0', BinaryFormat->"Integer32", Endianness->1)511 511 -16711680

See also

ToString ToInteger BinaryFormat

Equal==function

Syntax

Equal(exp1, exp2, … )exp1 == exp2 ==
gives True if all expressions expi are mathematically equal, and False if they are unequal.

Details

  • Equal verify the expressions for mathematical equality, unlike Same===.
  • Inexact numbers are considered as equal if they differ in at most their last five binary digits.

Examples

1 == 1True

3.0 == 3True

0.2 == 1/5True

The integer 1 and the real number 1.0 are mathematically equal, but not identical.

1 == 1.0 1 === 1.0True
False

The equality of Overflows is unknown, but they are identical.

Overflow == Overflow
Overflow === Overflow
Overflow == Overflow
True

Equal stays unevaluated if equality is unknown.

a == ba == b

Possible Issues

Inexact numbers are considered as equal if just the last one or two decimal digits are different. This allows an easier handling with floating point numbers.

1.0000000000000000002 == 1.0000000000000000001True

1.00000000000000000020 == 1.00000000000000000010False

See also

Unequal!= Same===

Erffunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5

Syntax

Erf(x)
gives the error function value of x.

Details

  • Erf gives an exact result when possible.
  • Erf has the attribute Listable.
  • To resolve small differences to 1 for large value of x, Erfc can be used.
  • For calculations with an arbitrary precision the Taylor series and continued fraction is used.

Examples

Erf(1.0)0.842701

Calculate(Erf(1), 70)0.8427007929497148693412206350826092592960669979663029084599378978347173

Erf(-0.2)-0.222703

Erf(3.0)0.999978

Particular arguments and their result:

Erf(0)0

Erf(Infinity)1

Possible Issues

Erf rapidly reaches 1.0 for positive numbers. A calculation requires higher precision to resolve the correct result.

1 - Calculate(Erf(10)) 1 - Calculate(Erf(10), 60)0.0 2.08848758376254e-45

Erfc can resolve the small difference to 1.0 without requiring higher precision.

Calculate(Erfc(10))2.08849e-45

See also

Erfc Exp

Erfcfunction

Function Plot

−5−4−3−2−101234554321−1−2−3−4−5