AAbsAccuracyAllAlternativesAndAnyAnyNullSequenceAnySequenceApplyArCoshArCothArCschArSechArSinhArTanhArcCosArcCotArcCscArcSecArcSinArcTanArgAttributes
BBernoulliBinaryFormatBinomialBoole
CCalculateCeilClearClearAttributesComplementComplexComplexInfinityComplexOverflowComplexUnderflowCompoundConditionConjugateContainCosCoshCotCothCountCscCsch
DDefineDefineDelayedDefinitionsDenominatorDepthDigitBaseDirectedInfinityDivide
EEEndiannessEqualErfErfcEulerMascheroniExpExpandExpression
FFactorialFalseFibonacciFlatFlattenFloorFunction
GGoldenAngleGoldenRatioGreaterGreaterEqual
HHarmonicNumberHeadHoldAllHoldFirstHoldRest
IIIfImIndeterminateInfinityIntegerInternalFormIntersectionIsEvenIsInfiniteIsNumericIsOddIsOverflowIsPrimeIsUnderflowIterateIterateParallel
JJoin
LLaunchKernelsLengthLessLessEqualListListableLockedLog
MMachinePrecisionMapMapParallelMatchingMaxMinMinusMod
OOptionalOptionsOrOrderOrderlessOutputOverflow
PPartPartitionPatternPausePiPlusPowerPrecisionPrintProtected
RRandomRationalRationalizeReRealReplaceRoundRuleRuleDelayed
SSameScopeSecSechSelectSequenceSequenceHoldSetAttributesShiftLeftShiftRightSignSinSinhSlotSortSpanSplitSqrtStringSubDefineSubDefineDelayedSubtractSymbolSymbols
TTanTanhTimesTimingToIntegerToRealToStringToSymbolTrueTrunc
XXor
Accuracy(z)
Accuracy(3.14)
14.4577
Accuracy(2.0e24)
-9.34644
Accuracy(1234567890123456.7890)
4.0
Alternatives(pat1, pat2, … )
pat1 | pat2 | …
Replace( {a, b, c, a, b, c} , a|b -> 0 )
{0, 0, c, 0, 0, c}
f( x?Rational | x?Integer ) := x^2;
{ f(2), f(1.0), f(1/2) }
{4, f(1.0), 1/4}
And(bool1, bool2, … )
bool1 && bool2 && …
And(int1, int2, … )
int1 && int2 && …
And(str1, str2, … )
str1 && str2 && …
12 && 7
4
'BINARY' && 'abc'
'@@B'
(Print(1);True) && False && (Print(2);True)
1
False
2==2 && a==5 && b==10 && True
a == 5 && b == 10
Any
?
Any(head)
?head
Matching( f(123), Any(f) )
True
Replace( { 1, 1.0, 1/2, 4 } , ?Integer -> x )
{x, 1.0, 1/2, x}
f(?Real) = "real";
{ f(1), f(1.0), f(2^0.5) }
{f(1), "real", "real"}
? + ?
Matching( a + b, ? + ? )
Matching( a + b, x? + y? )
2*Any
False
True
AnyNullSequence
???
AnyNullSequence(head)
???head
Matching( f(), f(AnyNullSequence) )
True
Matching( f(x, y), f(AnyNullSequence(Symbol)) )
True
Matching( f(), f(AnyNullSequence(Symbol)) )
True
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)}
AnySequence
??
AnySequence(head)
??head
Matching( f(1, 2, 3), f(AnySequence) )
True
Matching( f(x, y), f(AnySequence(Symbol)) )
True
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)}
Apply(g, f(1, a, x))
g(1, a, x)
Plus @@ {2, 3, 4}
9
f @@ (a+b)
f(a, b)
Apply( #1^#2 & , {3, 2} )
9
ArCosh(z)
ArCosh(1.5)
0.962424
Calculate(ArCosh(3/2), 70)
0.9624236501192068949955178268487368462703686687713210393220363376803277
ArCosh(2.0+3.0*I)
1.98339+1.00014*I
ArCosh(1)
0
ArcTan(z)
ArcTan(x,y)
ArcTan(2.0)
1.10715
Calculate(ArcTan(2), 70)
1.107148717794090503017065460178537040070047645401432646676539207433710
ArcTan(2.0+3.0*I)
1.40992+0.229073*I
ArcTan(0)
0
ArcTan(-1.0, -3.0)
-1.89255
ArSech(z)
ArSech(0.5)
1.31696
Calculate(ArSech(1/2), 70)
1.316957896924816708625046347307968444026981971467516479768472256920460
ArSech(2.0+1.0*I)
0.215612-1.16921*I
ArSech(1)
0
ArTanh(z)
ArTanh(0.5)
0.549306
Calculate(ArTanh(1/2), 70)
0.5493061443340548456976226184612628523237452789113747258673471668187471
ArTanh(2.0+3.0*I)
0.146947+1.33897*I
ArTanh(0)
0
Attributes(s)
Attributes(s) = attr
Attributes(s) = {attr1, attr2, …}
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. |
Attributes(Plus)
{Flat, Listable, Locked, NumericFunction, OneIdentity, Orderless, Protected}
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)
Attributes(g) = Listable;
g(x?) := "<" ~ ToString(x) ~ ">"
g(7)
"<7>"
g({-1,2,a})
{"<-1>", "<2>", "<a>"}
Bernoulli(n)
BinaryFormat -> type
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. |
ToString(12345, BinaryFormat->"Integer16")
ToString(3.1415, BinaryFormat->"double")
'90'
'o\x12\x83ÀÊ!\t@'
ToInteger('ÿ', BinaryFormat->"Integer8")
ToInteger('ÿ', BinaryFormat->"UnsignedInteger8")
-1
255
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ä€𝄞"
ToString(12345, BinaryFormat->"Integer8")
ToString(12345, BinaryFormat->"float16")
'9'
'\ar'
ToReal('\ar', BinaryFormat->"float16")
12344.0
Binomial(n, k)
Binomial(49, 6)
13983816
Binomial(365, 31)
884481797664650696626118102000059032909354320
Binomial(7/2, 3/2)
35/8
Binomial(3.5, 2.1)
4.26099
(10^20)!
Overflow
Binomial(10^20, 3)
166666666666666666661666666666666666666700000000000000000000
Calculate(exp)
Calculate(exp, n)
Log(-5) // Calculate
1.60944+3.14159*I
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(Log(-5), 25)
1.609437912434100374600759+3.141592653589793238462643*I
Calculate(Cos(2^10), 50)
0.98735361821984829524651338092244419111051208085007
x = Calculate(Pi, 15)
3.14159265358979
Calculate(x, 30)
3.14159265358979
y = Calculate(Sin(10^40), 30)
-0.569633400953636327308
y // Precision
21.6803
Calculate(Exp(1/10^100)-1, 30)
0.e-61
Calculate(z^4)
z^4
Clear(s)
Clear({s1, s2, … })
x = 123
123
x^2
15129
Clear(x)
x^2
x^2
f(10) = 0
f(z?Integer) := 2*z
f(z?) * w? @:= -w*z
0
Definitions(f)
f(10) = 0
f(Pattern(z, ?Integer)) := 2*z
f(Pattern(z, Any))*Pattern(w, Any) @:= Minus(w*z)
Clear(f)
Definitions(f)
/* no definitions */
ClearAttributes(s)
ClearAttributes(s, attr)
ClearAttributes(s, {attr1, attr2, … } )
Boole({True, False, True})
{1, 0, 1}
ClearAttributes(Boole, Listable)
{Listable}
Boole({True, False, True})
Boole({True, False, True})
Complement(list, list1, list2, … )
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( a + b + c + d , a + c )
b + d
Complement( f(1, 4, 2), f(2, 3) )
f(1, 4)
Complement( f(1, 4, 2), g(2, 3) )
Complement(f(1, 4, 2), g(2, 3))
Complex(x, y)
x + y*I
Complex
ComplexInfinity
Abs(ComplexInfinity) > Abs(ComplexOverflow)
True
1 / ComplexInfinity
0
1 / 0
ComplexInfinity
ComplexOverflow
(7.0+4.0*I) ^ Exp(100.0)
ComplexOverflow
3.14 + ComplexOverflow
ComplexOverflow
ComplexOverflow * (-2)
ComplexOverflow
ComplexUnderflow
(7.0+4.0*I) ^ (-Exp(100.0))
ComplexUnderflow
3.14 + ComplexUnderflow
3.14+0.0*I
ComplexUnderflow * (-2)
ComplexUnderflow
1 / ComplexUnderflow
ComplexOverflow
Condition(pat, cond)
pat /? cond
Matching( 1, x? /? x>0 )
Matching( -1, x? /? x>0 )
True
False
f(x? /? x!=0) := 1/x
f(2)
f(1/2)
f(0)
1/2
2
f(0)
g(x?, y?) /? x>y := x^y
g(10, 2)
g(2, 4)
g(x, 3)
100
g(2, 4)
g(x, 3)
Replace( {-1,2,-3,4,-5,6} , x?Integer /? x<0 -> 0 )
{0, 2, 0, 4, 0, 6}
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}
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
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
Cos(z)
Cos(2.0)
-0.416147
Calculate(Cos(2), 70)
-0.4161468365471423869975682295007621897660007710755448907551499737819649
Cos(2.0+3.0*I)
-4.18963-9.10923*I
Cos(0)
1
Cosh(z)
Cosh(2.0)
3.7622
Calculate(Cosh(2), 70)
3.762195691083631459562213477773746108293973558230711602777643347588324
Cosh(2.0+3.0*I)
-3.72455+0.511823*I
Cosh(0)
1
Cot(z)
Cot(2.0)
-0.457658
Calculate(Cot(2), 70)
-0.4576575543602857637502774104320472764284863292316743296413921626362923
Cot(2.0+3.0*I)
-0.00373971-0.996758*I
Coth(z)
Coth(1.0)
1.31304
Calculate(Coth(1), 70)
1.313035285499331303636161246930847832912013941240452655543152967567084
Coth(1.0+2.0*I)
0.82133+0.171384*I
Count(exp, el)
Count(str, sr)
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
Count( 3+3*x+4*x^2, x)
2
Count( 2 + 2*x + 3*x^2 , x^y?)
1
Count( "foobaabaabaafoofoobaa", "baa")
4
Count( 'ABAABABAA', 'A')
6
Count( {2.0, 2.0, 3.0} , 2 )
Count( {2.0, 2.0, 3.0} , 2.0 )
0
2
Csc(z)
Csc(2.0)
1.09975
Calculate(Csc(2), 70)
1.099750170294616466756697397026312896658764443149845708742554443062569
Csc(2.0+3.0*I)
0.0904732+0.041201*I
Csch(z)
Csch(2.0)
0.275721
Calculate(Csch(2), 70)
0.2757205647717832077583514821630271212496226719912580519731712337225655
Csch(2.0+3.0*I)
-0.272549-0.0403006*I
Define(lhs, rhs)
lhs = rhs
x = 123
123
x*2
246
y = a^2 + b^2
a^2 + b^2
2*y
2*(a^2 + b^2)
{a, b, c} = {123, 3.14, "Test"};
a
b
c
123
3.14
"Test"
f(z?) = z^2 + z
z + z^2
f(9)
f(a+b)
90
16037.4
f(z?, n?) = z^n + z
z + z^n
f(w)
f(w, 5)
w + w^2
w + w^5
x = 3.14
3.14
h(x?) = 2*x
6.28
k(x?) := 2*x
h(123)
k(123)
6.28
246
DefineDelayed(lhs, rhs)
lhs := rhs
x := 123
x*2
246
y := a^2 + b^2
2*y
2*(a^2 + b^2)
{a, b, c} := {123, 3.14, "Test"}
a
b
c
123
3.14
"Test"
f(z?) := z^2 + z
f(9)
f(a+b)
90
16037.4
f(z?, n?) := z^n + z
f(w)
f(w, 5)
w + w^2
w + w^5
m = 2
2
k(q?) := m*q
h(q?) = m*q
2*q
h(a)
k(a)
246
246
m = 5
5
h(123)
k(123)
246
615
Definitions(s)
Definitions(Plus)
Plus(AnyNullSequence) /* built-in function */
f(1) = 1;
f(x?) := f(x-1)+f(x-2);
f(2) = 1;
f(x? /? x <= 0) = 0;
Definitions(f)
f(1) = 1
f(2) = 1
f(Condition(Pattern(x, Any), x <= 0)) = 0
f(Pattern(x, Any)) := f(x - 1) + f(x - 2)
Denominator(z)
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
Depth(exp)
Depth( { {1,2}, 3, {4,{5,6}} } )
3
Depth( 123 )
0
Depth( f(x^2) )
2
Depth( a + 2*b^2 + 3*c )
3
Depth( 1/3 )
0
a/b
Depth( a/b )
a/b
2
InternalForm( a/b )
Times(a, Power(b, -1))
DirectedInfinity()
DirectedInfinity(z)
DirectedInfinity(1.0+I) * DirectedInfinity(I)
DirectedInfinity(-0.707107+0.707107*I)
DirectedInfinity(I) ^ 4
Infinity
Tan(DirectedInfinity(1+I))
I
ArcCos(Infinity)
DirectedInfinity(I)
ArTanh(DirectedInfinity(I))
1/2*I*Pi
4 / 2
2
x^5 / x^2
x^3
4 / 6
4.0 / 6
2/3
0.666667
Endianness -> -1
Endianness -> 1
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
1 == 1
True
3.0 == 3
True
0.2 == 1/5
True
Overflow == Overflow
Overflow === OverflowOverflow == Overflow
True
a == b
a == b
1.0000000000000000002 == 1.0000000000000000001
True
1.00000000000000000020 == 1.00000000000000000010
False
Erf(x)
Erf(1.0)
0.842701
Calculate(Erf(1), 70)
0.8427007929497148693412206350826092592960669979663029084599378978347173
Erf(-0.2)
-0.222703
Erf(3.0)
0.999978
Erf(0)
0
1 - Calculate(Erf(10))
1 - Calculate(Erf(10), 60)
0.0
2.08848758376254e-45