AAbsAllAlternativesAndAnyAnyNullSequenceAnySequenceApplyArCoshArSinhArTanhArcCosArcSinArcTanArgAttributes
CCalculateCeilClearComplementComplexComplexInfinityComplexOverflowComplexUnderflowCompoundConditionConjugateCosCosh
DDefineDefineDelayedDefinitionsDepthDigitBaseDirectedInfinityDivide
EEEndiannessEqualEulerMascheroniExpExpandExpression
FFactorialFalseFibonacciFlatFloorFunction
GGoldenAngleGoldenRatioGreaterGreaterEqual
HHead
IIIfImIndeterminateInfinityIntegerInternalFormIntersectionIterate
JJoin
LLengthLessLessEqualListListableLockedLog
MMachinePrecisionMapMatchingMaxMinMinusMod
OOptionalOptionsOrOrderOrderlessOutputOverflow
PPartPartitionPatternPiPlusPowerPrecisionPrintProtected
RRandomRationalReRealReplaceRuleRuleDelayed
SSameScopeSelectSequenceSignSinSinhSlotSortSpanSqrtStringSubDefineSubDefineDelayedSubtractSymbol
TTanTanhTimesToIntegerToRealToStringToSymbolTrueTrunc
XXor
Abs(z)
Abs(-123)
123
Abs(1.2 + 3.4*I)
3.60555
Abs(3+4*I)
5
Abs(Sin(4))
-Sin(4)
-Sin(4) // Calculate
0.756802
Abs(-2*x)
2*Abs(x)
Abs(x^3)
Abs(x)^3
All
Part( {{a1,a2}, {b1,b2}, {c1,c2}} , All, 1 )
{a1, b1, c1}
{"Hello", "World!"}[All, 1]
{"H", "W"}
Alternatives(pat1, pat2, … )
pat1 | pat2 | …
Matching( b, a|b )
True
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 && …
True && False
False
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 )
True
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*?
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(h, exp)
Apply(g, f(1, a, x))
g(1, a, x)
Apply(Plus, {2, 3, 4})
9
Apply(Times, a+b+c)
a*b*c
Apply(f, a+b)
f(a, b)
Apply( {#1^#2, #2^#1} & , {3, 2} )
{9, 8}
ArcCos(z)
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
ArcCos(-1)
Pi
ArcCos(0)
1/2*Pi
ArcCos(1/2)
1/3*Pi
ArcCos(1)
0
ArCosh(z)
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
ArCosh(1)
0
ArCosh(-1)
I*Pi
ArCosh(0)
1/2*I*Pi
ArCosh(1/2)
1/3*I*Pi
ArcSin(z)
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
ArcSin(-1)
-1/2*Pi
ArcSin(0)
0
ArcSin(1/2)
1/6*Pi
ArcSin(1)
1/2*Pi
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)
1/4*Pi
ArcTan(3^(1/2))
1/3*Pi
ArcTan(Infinity)
1/2*Pi
ArcTan(1, 1)
1/4*Pi
ArcTan(-1, 0)
Pi
ArcTan(-1.0, -3.0)
-1.89255
Arg(z)
Arg(1.2 + 3.4*I)
1.2315
Arg(-123)
Pi
Arg(1+I)
1/4*Pi
Arg(2.5)
0
Arg(-2*x)
Arg(-x)
Arg(x^(1/3))
1/3*Arg(x)
Arg(Abs(z))
0
ArSinh(z)
ArSinh(1.5)
1.19476
Calculate(ArSinh(3/2), 70)
1.194763217287109304111930828519090523536162075153005429270680299461324
ArSinh(2.0+3.0*I)
1.96864+0.964659*I
ArSinh(0)
0
ArSinh(1*I)
1/2*I*Pi
ArSinh(1/2*I)
1/6*I*Pi
ArTanh(z)
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
ArTanh(0)
0
ArTanh(1)
-Infinity
ArTanh(I)
1/4*I*Pi
ArTanh(-Infinity)
1/2*I*Pi
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. |
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}
{Orderless, Flat}
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>"}
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)
n! |
k! (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
Boole(False)
0
Boole(32 > 30)
1
Boole(a<b)
Boole(a < b)
Calculate(exp)
Calculate(exp, n)
Log(-5)
I*Pi + Log(5)
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
Ceil(x)
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(Overflow)
Overflow
Ceil(Underflow)
1
Ceil(-Underflow)
0
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, ?))*Pattern(w, ?) := Minus(w*z)
Clear(f)
Definitions(f)
/* no definitions */
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))
x + y*I
Complex
Head(1+2*I)
Complex
(1-I)^3
-2-2*I
1/2 + 0.4*I
1/2+0.4*I
Sqrt(-4)
2*I
Log(-0.5)
-0.693147+3.14159*I
ComplexOverflow * ComplexUnderflow
Indeterminate
ComplexInfinity
Abs(ComplexInfinity) > Abs(ComplexOverflow)
True
1 / ComplexInfinity
0
1 / 0
ComplexInfinity
Log(ComplexInfinity)
Infinity
ComplexOverflow
(7.0+4.0*I) ^ Exp(100.0)
ComplexOverflow
3.14 + ComplexOverflow
ComplexOverflow
ComplexOverflow * (-2)
ComplexOverflow
Abs( ComplexOverflow )
Overflow
Arg( ComplexOverflow )
Indeterminate
ComplexUnderflow
(7.0+4.0*I) ^ (-Exp(100.0))
ComplexUnderflow
3.14 + ComplexUnderflow
3.14+0.0*I
ComplexUnderflow * (-2)
ComplexUnderflow
1 / ComplexUnderflow
Indeterminate
Abs( ComplexUnderflow )
Underflow
Arg( ComplexUnderflow )
Indeterminate
Compound(exp1, exp2, … )
exp1 ; exp2 ; …
exp;
x = 1 ; y = 2 ; x + y
3
z = 10^10000;
Log(10, z)
10000
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}
Conjugate(z)
Conjugate(1+I)
1-I
Conjugate(1.2 - 3.4*I)
1.2+3.4*I
Conjugate(-123)
-123
Conjugate(I*Infinity)
DirectedInfinity(-I)
Conjugate(-2*x)
-2*Conjugate(x)
Conjugate(Log(3+I))
Log(3-I)
Conjugate((-2)^(1/2))
-I*2^(1/2)
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
Cos(Pi/2)
0
Cos(Pi/3)
1/2
Cos(Pi/4)
1/2^(1/2)
Cos(2*I)
Cosh(2)
Cos(ArcCos(z))
z
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
Cosh(I*Pi)
Cosh(I*Pi)
Cosh(2*I)
Cos(2)
Cosh(ArCosh(z))
z
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(???) /* 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, ?), x <= 0)) = 0
f(Pattern(x, ?)) := f(x - 1) + f(x - 2)
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
Depth( 1+2*I )
0
a/b
a/b
Depth( a/b )
2
InternalForm( a/b )
Times(a, Power(b, -1))
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
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
E
Calculate(E)
2.71828
Calculate(E, 70)
2.718281828459045235360287471352662497757247093699959574966967627724077
2*E
2*E
2.0*E
5.43656
Log(E)
1
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
1 == 1.0
1 === 1.0
True
False
Overflow == Overflow
Overflow === Overflow
Overflow == Overflow
True
a == b
a == b
1.0000000000000000002 == 1.0000000000000000001
True
1.00000000000000000020 == 1.00000000000000000010
False
EulerMascheroni
Calculate(EulerMascheroni)
0.577216
Calculate(EulerMascheroni, 70)
0.5772156649015328606065120900824024310421593359399235988057672348848677
2*EulerMascheroni
2*EulerMascheroni
2.0*EulerMascheroni
1.15443
Exp(z)
Exp(-2.5)
0.082085
Exp(1000.0)
1.970071114017e434
Exp(3.0+2.0*I)
-8.35853+18.2637*I
Calculate(Exp(10), 70)
22026.46579480671651695790064528424436635351261855678107423542635522520
Exp(0)
1
Exp(1)
E
Exp(-Infinity)
0
Expand(exp)
Expand( 3*(a+b) )
3*a + 3*b
Expand( (a+b)^2 )
a^2 + 2*a*b + b^2
Expand( (Pi+1)^3 * (E-2) )
-2 + E - 6*Pi + 3*E*Pi - 6*Pi^2 + 3*E*Pi^2 - 2*Pi^3 + E*Pi^3
Expand( (a+b)^2 + (a-b)^2 )
2*a^2 + 2*b^2
head(arg1, arg2, … )
head @ arg
arg // head
Head( func(a, b) )
func
Head( h(y)(a, b) )
h(y)
func @ 123
func(123)
123 // func
func(123)
f(1) = 2
f(foo) = 3
f("bar") = 4
2
3
4
{ f(), f(0), f(1) }
{ f(foo), f(bar), f("bar"), f("foo") }
{f(), f(0), 2}
{3, f(bar), 4, f("foo")}
g(x?) := x^2
{ g(7) , g(a) , g(2+b) }
{49, a^2, (2 + b)^2}
Factorial(10)
3628800
50!
30414093201713378043612608166064768844377641568960512000000000000
(-5)!
ComplexInfinity
6.32!
1321.18
1000.0!
4.02387260077e2567
Calculate(Factorial(22/7), 70)
7.199869288735633700776845665344668943490127819531077381591855761162949
(-1/2)!
Pi^(1/2)
(2.1+0.4*I)!
1.97507+0.802929*I
False
1 == 2
False
Not(False)
True
Fibonacci(n)
φn − cos(π n) φ−n |
5 |
Fibonacci(10)
55
Fibonacci(350)
6254449428820551641549772190170184190608177514674331726439961915653414425
Fibonacci(-10)
-55
Fibonacci(10.0)
55.0
Fibonacci(16.32)
1151.31
Fibonacci(10000.0)
3.36447648764e2089
Calculate(Fibonacci(22/7), 70)
2.118038120159998741207512266041453547560232382534595267287508988177487
Fibonacci(2.1+0.4*I)
0.932786+0.370984*I
a + (b + c)
a + b + c
f(1, f(2, 3))
f(1, f(2, 3))
Matching( f(1, 2, 3) , f(x?, y?) )
False
Attributes(f) = Flat
Flat
f(1, f(2, 3))
f(1, 2, 3)
f(1, 2, 3) /: f(x?, y?) :> {x, y}
{1, f(2, 3)}
Floor(x)
Floor(-2.1)
-3
Floor(2.9)
2
Floor(7/8)
0
Floor(1.2 + 3.8*I)
1+3*I
Floor(Log(10))
2
Floor(Overflow)
Overflow
Floor(Underflow)
0
Floor(-Underflow)
-1
f = Function( 2*#+1 )
Function(2*#1 + 1)
f(x)
f(5)
1 + 2*x
11
g = #1^#2 + #2^#1 &
Function(#1^#2 + #2^#1)
g(x, y)
g(4,3)
x^y + y^x
145
Select( {1,2,3,4} , #<3 & )
{1, 2}
f = {#1, #2} &
Function({#1, #2})
f(a,b,c)
{a, b}
f(a,b)
{a, b}
f(a)
{a, #2}
GoldenAngle
2 π |
φ2 |
2 π |
φ2 |
Calculate(GoldenAngle)
2.39996
Calculate(GoldenAngle, 70)
2.399963229728653322231555506633613853124999011058115042935112750731307
Calculate(GoldenAngle*180/Pi)
137.508
GoldenRatio
1+5 |
2 |
Calculate(GoldenRatio)
1.61803
Calculate(GoldenRatio, 70)
1.618033988749894848204586834365638117720309179805762862135448622705260
2 > 1
True
1/3 > 0 > -0.5
True
x > 2 > 2
False
2 > 1 > x
1 > x
Sin(2) > 0
True
GreaterEqual(x1, x2, … )
x1 >= x2 >= …
2 >= 1
True
3/2 >= 1.5 >= -0.5
True
x >= 1 >= 2
False
2 >= 1 >= x
1 >= x
Sin(2) >= 0
True
Head(exp)
Head( f(a, b) )
f
Head( 123 )
Integer
Head( a * b )
Times
{1, 2, 3}[0]
List
a/b
Head(a/b)
a/b
Times
InternalForm(a/b)
Times(a, Power(b, -1))
I
I // Head
Complex
I * I
-1
(-4)^(1/2)
2*I
If(True, 123, -10)
If(False, 123, -10)
123
-10
x = 3; If(x!=0, 1.0/x, "Div 0")
x = 0; If(x!=0, 1.0/x, "Div 0")
0.333333
"Div 0"
If(a==b, 1, 2)
If(a == b, 1, 2)
If(a==b, 1, 2, 3)
3
Im(z)
Im(1+I)
1
Im(1.2 - 3.4*I)
-3.4
Im(-123)
0
Im(Log(-6))
Pi
Im(I*Infinity)
Infinity
Im(-2*x)
-2*Im(x)
Im(3+Pi+z)
Im(z)
Im(Abs(z))
0
Im(Exp(2+3*I))
E^2*Sin(3)
Indeterminate
0 / 0
Indeterminate
0 ^ 0
Indeterminate
Infinity - Infinity
Indeterminate
Infinity
Infinity > Overflow
True
1 / Infinity
0
Log(0)
-Infinity
E^(-Infinity)
0
Tanh(Infinity)
1
Tanh(Overflow)
1.0
Log(0.0)
Indeterminate
n
Integer
Head(123)
Integer
12 + 34
46
32845723658234756 * 346594876456456546
11384159533448787206618577180912776
11384159533448787206618577180912776 / 346594876456456546
32845723658234756
3^200
265613988875874769338781322035779626829233452653394495974574961739092490901302182994384699044001
InternalForm(exp)
InternalForm(4+2*I)
Complex(4, 2)
InternalForm(1/5)
Rational(1, 5)
InternalForm(1+2*x)
Plus(1, Times(2, x))
InternalForm(x?Integer)
Pattern(x, Any(Integer))
InternalForm(a-b)
Plus(a, Times(-1, b))
InternalForm(1/x)
Power(x, -1)
InternalForm(Exp(z))
Power(E, z)
Intersection(list1, list2, … )
Intersection( {4,3,3,1} , {1,4,4,5} )
{1, 4}
Intersection( {x, y} , {u, v} )
{}
Intersection( {1,2,3} , {1,10,100} , {1,2,4,8} )
{1}
Intersection( a + b + d , a + c + d )
a + d
Intersection( f(1, 4, 2), f(2, 3, 4) )
f(2, 4)
Intersection( f(1, 2), g(2, 3) )
Intersection(f(1, 2), g(2, 3))
Iterate(exp, n)
Iterate(exp, {i, imax} )
Iterate(exp, {i, imin, imax} )
Iterate(exp, {x, xmin, xmax, xstep} )
Iterate(exp, {e, {e1, e2, …, en } } )
Iterate(exp, spec1, spec2, … )
Iterate(0, 8)
{0, 0, 0, 0, 0, 0, 0, 0}
Iterate("Text", 4)
{"Text", "Text", "Text", "Text"}
Iterate(i, {i, 10} )
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
Iterate(i^2, {i, -3, 3} )
{9, 4, 1, 0, 1, 4, 9}
Iterate(x, {x, 0.5, 0.9, 0.1} )
{0.5, 0.6, 0.7, 0.8, 0.9}
Iterate(w*2, {w, {1,0.7,t,1/3} } )
{2, 1.4, 2*t, 2/3}
Iterate(m+n*10, {m, 1, 4}, {n, 1, 4})
{{11, 12, 13, 14}, {21, 22, 23, 24}, {31, 32, 33, 34}, {41, 42, 43, 44}}
Iterate(m+n*10, {m, 1, n}, {n, 1, 4})
{{11}, {21, 22}, {31, 32, 33}, {41, 42, 43, 44}}
Iterate(Random(9), 10)
{8, 5, 3, 2, 7, 5, 3, 2, 6, 9}
Join( {1,2} , {3,4,5} )
{1, 2, 3, 4, 5}
Join( "Hello ", "World!" )
"Hello World!"
Join( a + b , c + d )
a + b + c + d
Join( f(1, 2), f(x) )
f(1, 2, x)
Length(exp)
Length(str)
Length( {1,2,3,4,5} )
5
Length( "Hello World!" )
12
Length( '\0\x80ÿ\n' )
4
Length( a + 2*b + c )
3
Length( f(a, b) )
2
Length( 1/3 )
0
Length( 1+2*I )
0
Minus(x)
-x
Length( -x )
2
InternalForm( -x )
Times(-1, x)
1 < 2
True
-0.5 < 0 < 1/3
True
x < 2 < 2
False
1 < 2 < x
2 < x
Sin(4) < 0
True
1 <= 2
True
-0.5 <= 1.5 <= 3/2
True
x <= 2 <= 1
False
1 <= 2 <= x
2 <= x
Sin(4) <= 0
True
List( 1, 2, 3 )
{1, 2, 3}
{{a1,a2}, {b1,b2}}
{{a1, a2}, {b1, b2}}
Sqrt({1, 4, 9})
{1, 2, 3}
Exp({0.0, 1.0, 10.0})
{1.0, 2.71828, 22026.5}
{a, b} + {c, d}
{a + c, b + d}
Sin({x, 2, 0.5})
{Sin(x), Sin(2), 0.479426}
f({1, 2, 3})
f({1, 2, 3})
Attributes(f) = Listable
Listable
f({1, 2, 3})
{f(1), f(2), f(3)}
f({1, 2, 3}, {a, b, c})
{f(1, a), f(2, b), f(3, c)}
Attributes(Plus) = Flat
Flat
Attributes(f) = {Flat, Locked}
{Flat, Locked}
Attributes(f) = {Orderless}
{Orderless}
Attributes(f)
{Flat, Locked}
Log(1000.0)
6.90776
Log(-3.14)
1.14422+3.14159*I
Log(3.0+2.0*I)
1.28247+0.588003*I
Calculate(Log(100), 70)
4.605170185988091368035982909368728415202202977257545952066655801935145
Log(E)
1
Log(0)
-Infinity
Log(-1)
I*Pi
Log(10, 1000)
3
Log(4.5, 4.5^100000)
1.0e5
Log(2/3, 16/81)
4
Log(1/4, 8)
-3/2
Log(2, 100)
Log(100)/Log(2)
MachinePrecision
Calculate(MachinePrecision)
15.9546
Precision(3.1415)
MachinePrecision
Precision(789.456e123)
MachinePrecision
Precision(123.4e5678)
15.9546
Map(f, g(1, a, x))
g(f(1), f(a), f(x))
Map(Cos, Pi+b+c)
-1 + Cos(b) + Cos(c)
#^2 & /@ {4, 9, a, 0.4}
{16, 81, a^2, 0.16}
Matching(exp, pat)
Matching(123, ?Integer)
Matching(123.0, ?Integer)
True
False
Matching({a, b, c}, {??Symbol})
Matching({a, 2, b}, {??Symbol})
True
False
Matching({10, 11}, {x?, x?})
Matching({10, 10}, {x?, x?})
False
True
Matching({2, 1}, {x?, y?} /? x>y )
Matching({1, 2}, {x?, y?} /? x>y )
True
False
Max(x1, x2, … )
Max( {x1, x2, … }, {xn + 1, xn + 2, … }, … )
Max(3, -2, 1.0)
3
Max(E, Pi)
Pi
Max({4,2,-4}, {9, 0, 4})
9
Max(3, "test", -5, 2+I, 4)
Max("test", 2+I, 4)
Min(x1, x2, … )
Min( {x1, x2, … }, {xn + 1, xn + 2, … }, … )
Min(3, -2, 1.0)
-2
Min(E, Pi)
E
Min({4,2,-4}, {9, 0, 4})
-4
Min(3, "test", -5, 2+I, 4)
Min("test", 2+I, -5)
Minus(123)
-123
Minus(a+b+c)
-a - b - c
Minus(3+2*I)
-3-2*I
Minus(Minus(exp))
exp
Mod(m, n)
Mod(7, 3)
1
Mod(4.0, 1.2)
0.4
Mod(5/9, 1/2)
1/18
Mod(Pi, 2)
-2 + Pi
Mod(8*Pi, 3*Pi)
2*Pi
Mod(10, 5^(1/2))
10 - 4*5^(1/2)
Mod(14*a^2, 3*a^2)
2*a^2
Mod(7, 3)
1
Mod(-7, 3)
2
Mod(7, -3)
-2
Mod(-7, -3)
-1
Not(bool)
!bool
Not(int)
!int
Not(str)
!str
! False
True
! 15
-16
! 'BINARY'
'½¶±¾¦'
Not( x < 3 )
x >= 3
Not( x == 3 )
x != 3
Not( Not( exp ) )
exp
Null
Null
x := 1
z = 3;
{1, Print(2), z}
2
{1, 2, 3}
Matching( {1, 2}, {x?, y?:0} )
Matching( {1}, {x?, y?:0} )
True
True
f(x?, y?:2) := x^y
f(a, b)
f(a)
a^b
a^2
g(n?Integer:0, str?String) := {n, str}
g("Text")
g(10, "Text")
{0, "Text"}
{10, "Text"}
Options(sym1 -> val1, sym2 -> val2, … )
Options(sym1 :> val1, sym2 :> val2, … )
f(Options(x->1, y->2)) := {x, y}
f()
f(x->100)
f(y->100)
f(y->100, x->99)
{1, 2}
{100, 2}
{1, 100}
{99, 100}
f(Options(x->0)) := {x, x, x, x, x}
f()
f(x->Random(10))
f(x:>Random(10))
{0, 0, 0, 0, 0}
{10, 10, 10, 10, 10}
{7, 2, 8, 9, 9}
Or(bool1, bool2, … )
bool1 || bool2 || …
Or(int1, int2, … )
int1 || int2 || …
Or(str1, str2, … )
str1 || str2 || …
True || False
True
12 || 7
15
'BINARY' || 'abc'
'ckoARY'
(Print(1);False) || True || (Print(2);False)
1
True
1==2 || a==5 || b==10 || False
a == 5 || b == 10
Order(exp1, exp2)
Integern, Rationala/b and Realx numbers are ordered by their numerical value. |
Complexx+y*I numbers are ordered by their real part and then by their imaginary part. |
String"…",'…' are ordered using the Unicode collation algorithm. |
Numerical values are ordered before String"…",'…', Symbols and Expressionf(…). |
Order(123, var)
1
Order(1, 1+I)
1
Order("b", "a")
-1
Order(x^2, x^2)
0
Order(Pi, 4)
-1
a + c + b
a + b + c
f(1, b, 2, a)
f(1, b, 2, a)
Matching( f(x, 2) , f(?Integer, x) )
False
Attributes(f) = Orderless
Orderless
f(1, b, 2, a)
f(1, 2, a, b)
Matching( f(x, 2) , f(?Integer, x) )
True
Output(1+2, 3*4, 5^6)
3
12
15625
1+2
3*4
5^6
3
12
15625
f(Output(1,2,3))
f(Output(1, 2, 3))
Overflow
Exp(10.0^20.0)
Overflow
3.14 + Overflow
Overflow
Overflow * (-2)
-Overflow
3.14 / Overflow
Underflow
ArcTan(Overflow)
1.5708
Part(exp, level1, level2, … )
exp[level1, level2, … ]
Part(str, part)
str[part]
…[n] | gives the nth element of an expression or the nth character of a string. |
…[-n] | counts from the end of the expression or the string. |
…[0] | gives the head of an expression or the string. |
…[{n1, n2, … }] | gives the expression with elements specified by ni or the string with characters specified by ni. |
…[m..n] | gives the expression with a span of elements or the string with characters from m until n. |
…[m..n..s] | gives a span of elements or characters from m until n in steps of s, where s can also be negative. |
…[All] | gives the expression with all elements in this level or the string with all characters. |
Part( {a,b,c,d,e} , 3 )
c
"Hello World!"[-1]
"!"
{a,b,c,d,e}[{-1,3,3}]
{e, c, c}
"Hello World!"[{1,8,3,-2}]
"Hold"
{a,b,c,d,e}[2..-2]
{b, c, d}
{a,b,c,d,e}[-1..1..-1]
{e, d, c, b, a}
Part( "Hello World!" , 1..7..2 )
"HloW"
{{a1,a2}, {b1,b2}, {c1,c2}}[All, 2]
{a2, b2, c2}
Part( a+b*x+x^2 , 2, 1)
b
f(1, 2, x, 4, y)[3..5]
f(x, 4, y)
Part( 3/4 , 1 )
(3/4)[1]
Part( 2+3*I , 1 )
Re( 2+3*I )
(2+3*I)[1]
2
Part( a+c+b , 2)
a+c+b // InternalForm
b
Plus(a, b, c)
Part( (a*b)*(c*d) , 2)
(a*b)*(c*d) // InternalForm
b
Times(a, b, c, d)
Partition(str, n)
Partition(exp, n)
Partition( {1, 2, 3, 4, 5, 6} , 3 )
{{1, 2, 3}, {4, 5, 6}}
Partition( {1, 2, 3, 4, 5, 6} , 4 )
{{1, 2, 3, 4}}
Partition( "Hello World!" , 3 )
{"Hel", "lo ", "Wor", "ld!"}
Partition( "Hello World!" , 5 )
{"Hello", " Worl"}
Partition( f(1,2,3,4) , 2 )
f(f(1, 2), f(3, 4))
Pattern(sym, pat)
sym?
sym??
sym???
sym?head
sym??head
sym???head
f(x?, y?) := x ^ y
f(a, b)
a^b
g(x??) := Times(x)
g(3)
g(4, 5)
g(a, 6, x^2)
3
20
6*a*x^2
g(Pattern(x, ?Integer|Infinity)) := x^2
{ g(1), g(-5), g(Infinity), g(3.14) }
{1, 25, Infinity, 3.14}
Pi
Calculate(Pi)
3.14159
Calculate(Pi, 70)
3.141592653589793238462643383279502884197169399375105820974944592307816
2*Pi
2*Pi
2.0*Pi
6.28319
Cos(Pi)
-1
Log(-1)
I*Pi
ArcTan(Infinity)
1/2*Pi
1 + 2 + 3
6
2*x + 3*x
5*x
2 + 1/4
2 + 0.25
9/4
2.25
(a + c) + (b + 4)
4 + a + b + c
{1, 2, 3} + 10
{11, 12, 13}
{1, 2, x} + {5, 10, y}
{6, 12, x + y}
2 ^ 100
1267650600228229401496703205376
5 ^ (-2)
1/25
27 ^ (1/3)
10 ^ (1/3)
3
10^(1/3)
10 ^ (1/3) // Calculate
10.0 ^ (1/3)
2.15443
2.15443
2.5 ^ 1000
8.709809816217e397
{2, 3, 4} ^ 2
{4, 9, 16}
{2, 10} ^ {4, 3}
{16, 1000}
0^0
Indeterminate
0^(-1)
ComplexInfinity
10.0 ^ (10.0^20.0)
Overflow
0.5 ^ (10.0^20.0)
Underflow
Precision( z )
Precision(123)
Infinity
Precision(3/7)
Infinity
Precision(3.14)
MachinePrecision
Precision(Overflow)
0.0
Precision(123456.78901234567890)
20.0915
Precision(4.0 + 3*I)
MachinePrecision
Print(exp1, exp2, …, explast )
Print(1, 2, 3)
1
2
3
3
Print("String are shown\r\nwith line breaks\tand tabs.")
String are shown
with line breaks and tabs.
"String are shown\r\nwith line breaks\tand tabs."
Print(Hello, World, Null)
Hello
World
Print(Log(10, Print(2^10)-24 // Print)) * 21
1024
1000
3
63
Apply(Plus, Iterate(Print(Random(100)), 5))
97
80
89
68
34
368
Protected
Pi = 3
3
x = 123
123
Attributes(x) = Protected
Protected
x = 0
0
x
123
Random(z)
Random(list)
Random(7)
6
Random(2/3)
2/3
Random(2.0)
1.5129
Random(1.0+2.0*I)
0.752581+1.27174*I
Random( {a, b, c} )
b
Iterate( Random(9), 10 )
{3, 0, 4, 3, 0, 2, 5, 7, 8, 1}
a/b
Rational
Head(1/2)
Rational
4/12
1/3
5 + 1/3
16/3
1/123456 + 1/678901
802357/83814401856
(2/3)^100
1267650600228229401496703205376/515377520732011331036461129765621272702107522001
Re(z)
Re(1+I)
1
Re(1.2-3.4*I)
1.2
Re(-123)
-123
Re(Log(-6*I))
Log(6)
Re(ArcCos(2))
0
Re(Infinity)
Infinity
Re(-2*x)
-2*Re(x)
Re(3+Pi+z)
3 + Pi + Re(z)
Re(Abs(z))
Abs(z)
Re(Exp(2+3*I))
E^2*Cos(3)
x
Real
Head(1.0)
Real
4.0 * 0.7
2.8
1 + 2.0
3.0
1/3 + 1.0
1.33333
1.0000000000000000000000000000000000000000123 + 10
11.0000000000000000000000000000000000000000123
123.456 ^ 1000.0
3.25238259113e2091
0.012 ^ 1000.0
1.517910089172e-1921
Precision(123.456)
MachinePrecision
Precision(789.456e123)
MachinePrecision
x = 123.456 ^ 1000.0
y = 123.00000000000000000000456789
3.25238259113e2091
123.00000000000000000000456789
{ Precision(x) , Precision(y) }
{12.4798, 29.0899}
x ^ y
1.0018442638e257256
Precision(x^y)
10.3898
123.456 ^ (10^100)
Overflow
Head(Overflow)
Real
123.456 ^ (-10^100)
Underflow
Head(Underflow)
Real
Overflow * Underflow
Indeterminate
Underflow - Underflow
ComplexUnderflow
Replace(exp, rule)
exp /: rule
Replace(exp, {r1, r2, … })
exp /: {r1, r2, … }
Replace(str, a->b )
str /: a->b
x^2 + x /: x->4
20
{x+y, x*y, x^y} /: {x->2, y->3}
{5, 6, 8}
x^2 /: {2->x, x->2}
2^x
a+b+c+d /: a+d -> x
b + c + x
{a, b, 1, 2, 3.0, 0.4, "Hello", "World"} /: ?Real -> 0
{a, b, 1, 2, 0, 0, "Hello", "World"}
"Hello World!" /: "World" -> "User"
"Hello User!"
{x, y, z} /: {x->y, y->z, z->0}
{y, z, 0}
{x, x, x, x, x} /: x -> Random(10)
{0, 0, 0, 0, 0}
{x, x, x, x, x} /: x :> Random(10)
{7, 9, 1, 1, 5}
f(2, 3, 4) /: x? -> x^2
f(2, 3, 4)^2
f(2, 3, 4) /: x?Integer -> x^2
f(4, 9, 16)
Replace(x+y, { x->2, y->4 } )
6
Replace(a+b+c+d, b+c -> 4 )
4 + a + d
Replace({1, 2.0, 3, 4.0, 5}, ?Integer -> Null )
{Null, 2.0, Null, 4.0, Null}
Replace({1, 2.0, 3, 4.0, 5}, x?Integer -> x^2 )
{1, 2.0, 9, 4.0, 25}
x = 4
4
x?Integer -> x^2
Pattern(x, ?Integer) -> 16
Replace({2, 3, 4}, x?Integer -> x^2 )
{16, 16, 16}
x?Integer :> x^2
Pattern(x, ?Integer) :> x^2
Replace({2, 3, 4}, x?Integer :> x^2 )
{4, 9, 16}
Replace({1, x, 2, x, 3, x}, x :> Random(1000) )
{1, 337, 2, 986, 3, 384}
Replace({2, 3, 4}, x?Integer :> x^3 )
{8, 27, 64}
123 === "text"
False
x === y
False
f(5) === f(5)
True
1 === 1.0
1 == 1.0
False
True
Overflow === Overflow
Overflow == Overflow
True
Overflow == Overflow
x === 2
Replace( x === 2 , x->2 )
False
False
x == 2
Replace( x == 2 , x->2 )
x == 2
True
Scope(sym, body)
Scope({sym1, sym2, … }, body)
x = 123; a=3; b=4
4
Scope({x, y},
x=a+b; y=a-b;
x/y )
-7
{x, y, a, b}
{123, y, 3, 4}
Scope({z=2, w=3}, z*w )
6
{z, w}
{z, w}
Scope(x, x+y )
x$3 + y
Select( {"Hello", x+y, 4, 3+I, "World!", z} , Head(#)===String & )
{"Hello", "World!"}
check(x?) := x^2 < 6
Select( {1, 2, 3, 4, y, 2.2}, check )
{1, 2, 2.2}
Select( 1 + w - Pi + x^2 + E, Head(Calculate(#))===Real & )
1 + E - Pi
Sequence(arg1, arg2, … )
func(Sequence(a, b, c), d)
func(a, b, c, d)
arg = Sequence(2,4,6)
Plus(arg)
Times(arg)
Sequence(2, 4, 6)
12
48
f(1, 2, 3) /: f(x??) :> x
Sequence(1, 2, 3)
Sign(z)
Sign(-123)
-1
Sign(2.5)
1
Sign(1.2 + 3.4*I)
0.33282+0.94299*I
Sign(1+I)
(1+I)/2^(1/2)
Sign(Pi-E)
1
Sign(Sin(4))
-1
Sin(4) // Calculate
-0.756802
Sign(-2*x)
-Sign(x)
Sin(z)
Sin(2.0)
0.909297
Calculate(Sin(2), 70)
0.9092974268256816953960198659117448427022549714478902683789730115309673
Sin(2.0+3.0*I)
9.1545-4.16891*I
Sin(0)
0
Sin(Pi/2)
1
Sin(Pi/3)
1/2*3^(1/2)
Sin(Pi/4)
1/2^(1/2)
Sin(ArcSin(z))
z
Sinh(z)
Sinh(2.0)
3.62686
Calculate(Sinh(2), 70)
3.626860407847018767668213982801261704886342012321135721309484474934250
Sinh(2.0+3.0*I)
-3.59056+0.530921*I
Sinh(0)
0
Sinh(I*Pi)
Sinh(I*Pi)
Sinh(ArSinh(z))
z
Slot(n)
#n
#
Select( {0,1,2,3,4,5,6,7,8,9} , #<5 & )
{0, 1, 2, 3, 4}
f = Function(#1^#2)
f(a, b)
f(3, 4)
Function(#1^#2)
a^b
81
Sort(list)
Sort(list, cmp)
True | e1 and e2 are in order |
False | e1 and e2 are out of order |
1 | e1 comes before e2 |
-1 | e1 comes after e2 |
0 | e1 and e2 are identical |
Sort({ "Hello", x+y, 4, 3+I, z})
{3+I, 4, "Hello", z, x + y}
Sort( f(3,1,2) )
f(1, 2, 3)
Sort( {-3, 2, -1, 0, Pi, 4} )
{-3, -1, 0, 2, 4, Pi}
Sort( {-3, 2, -1, 0, Pi, 4}, GreaterEqual )
{4, Pi, 2, 0, -1, -3}
Sort( {-3, 2, -1, 0, Pi, 4}, Abs(#1) <= Abs(#2) & )
{0, -1, 2, -3, Pi, 4}
Sort({"NINO", "Nina", "Nino", "Ninu", "Niño"})
{"Nina", "Nino", "NINO", "Niño", "Ninu"}
Sort({"Hello", "Foo", "Baa", "World", "!"}, Length(#1) <= Length(#2) & )
{"!", "Foo", "Baa", "Hello", "World"}
Span(m, n)
m .. n
Span(m, n, s)
m .. n .. s
"Hello World!"[7..-1]
"World!"
"Hello World!"[-1..-6..-1]
"!dlroW"
{a, b, c, d, e}[1..5..2]
{a, c, e}
Sqrt(z)
Sqrt(16)
4
Sqrt(2.0)
1.41421
Sqrt(-0.5)
0.0+0.707107*I
Sqrt(0)
0
Sqrt(-1)
I
Sqrt(Infinity)
Infinity
"…"
'…'
String
\0 | NUL | \f | FF |
\a | BEL | \r | CR |
\b | BS | \" | " |
\t | TAB | \' | ' |
\n | LF | \\ | \ |
\v | VT | \x00 – \xFF | Two-digit hexadecimal code |
"abc αβγ \t ♦♥♠♣ \0 fl"
"abc αβγ \t ♦♥♠♣ \0 fl"
Head("abc αβγ \t ♦♥♠♣ \0 fl")
String
'\0\0ÿ7)<'
'\0\0ÿ7)<'
Head('\0\0ÿ7)<')
String
"Hello " + "World!"
"Hello " + "World!"
"Hello " ~ "World!"
"Hello World!"
'Cost: ' ~ "10 €"
'Cost: 10 â\x82¬'
SubDefine(lhs, rhs)
lhs @= rhs
f(beta) @= 2
2
Definitions(f)
/* no definitions */
Definitions(beta)
f(beta) = 2
{ f(alpha), f(beta), f(123) }
{f(alpha), 2, f(123)}
off + off @= off; off + on @= on; on + on @= off;
on + off
on + off + on
on
off
off + on = on;
f(alpha) = 1
f(alpha) @= 2
1
2
f(alpha)
2
SubDefineDelayed(lhs, rhs)
lhs @:= rhs
f(a(x?)) @:= x^2
Definitions(f)
/* no definitions */
Definitions(a)
f(a(Pattern(x, ?))) := x^2
{ f(7), f(a(7)), f(a) }
{f(7), 49, f(a)}
angle(x?) + angle(y?) @:= angle( Mod(x+y, 360) )
angle(270) + angle(180)
angle(90)
angle(x?) + angle(y?) := angle( Mod(x+y, 360) )
f(g(x?)) := x^2
f(g(x?)) @:= x*2
f(g(10))
20
3 - 2
1
2*x - 3*x
-x
2 - 1/4
2 - 0.25
7/4
1.75
s
Symbol
Head(var)
Symbol
foo + foo
2*foo
x = 123
y = 4
123
4
{ x+y, x*y, x^y }
{127, 492, 228886641}
φ = a*b^2
a*b^2
{ φ , φ/b }
{a*b^2, a*b}
ToSymbol("world")
world
Var = 123
123
{Var, var}
{123, var}
True := 123 ; 2*True
2*True
Tan(z)
Tan(2.0)
-2.18504
Calculate(Tan(2), 70)
-2.185039863261518991643306102313682543432017746227663164562955869966774
Tan(2.0+3.0*I)
-0.00376403+1.00324*I
Tan(0)
0
Tan(Pi/2)
ComplexInfinity
Tan(Pi/3)
3^(1/2)
Tan(Pi/4)
1
Tan(ArcTan(z))
z
Tanh(z)
Tanh(1.0)
0.761594
Calculate(Tanh(1), 70)
0.7615941559557648881194582826047935904127685972579365515968105001219532
Tanh(2.0+0.5*I)
0.979941+0.030216*I
Tanh(0)
0
Tanh(I*Pi)
Tanh(I*Pi)
Tanh(Infinity)
1
Tanh(ArTanh(z))
z
2 * 3 * 4
24
x^2 * x^3
x^5
2 * 1/4
2 * 0.25
1/2
0.5
(a * c) * (b * 4)
4*a*b*c
{1, 2, 3} * 10
{10, 20, 30}
{1, 2, x} * {5, 10, y}
{5, 20, x*y}
DigitBase | Base of the digits to parse from a text string. The default base is 10. |
BinaryFormat | Format, how to parse a binary string. |
Endianness | Byte order in a binary string. |
ToInteger(3/2)
1
ToInteger(-3.1415)
-3
ToInteger(5+2*I)
5
ToInteger(E)
2
ToInteger(Pi^2)
9
ToInteger("12345")
12345
ToInteger("FF", DigitBase->16)
255
ToInteger('Oa¼\0', BinaryFormat->"Integer32")
12345679
ToInteger('\0\0\0@êítFÐ\x9C,\x9F\f')
1000000000000000000000000000000
ToInteger(Overflow)
ToInteger(Overflow)
ToInteger({1,2,3})
ToInteger({1, 2, 3})
DigitBase | Base of the digits to parse from a text string. The default base is 10. |
BinaryFormat | Format, how to parse a binary string. |
ToReal(123)
123.0
ToReal(3/5)
0.6
ToReal(5+2*I)
5.0
ToReal(E)
2.71828
ToReal(Pi^2)
9.8696
ToReal("123.45")
123.45
ToReal("FF.8", DigitBase->16)
255.5
ToReal('yéöB', BinaryFormat->"float32")
123.456
ToReal(ComplexOverflow)
Indeterminate
ToReal({1,2,3})
ToReal({1, 2, 3})
ToString(str)
ToString(exp)
BinaryFormat | Format of the string encoding. |
DigitBase | Base of the digits in a text string. The default base is 10. |
Endianness | Byte order in a binary string. |
ToString(123)
"123"
ToString(3/2)
"3/2"
ToString(-3.1415)
"-3.141500000000000"
ToString(123.45678901234567890123456789e12345)
"1.2345678901234567890123456789e12347"
ToString(5+2*I)
"5+2i"
ToString(E)
"E"
ToString(Pi^2)
"Power(Pi, 2)"
ToString("yä€𝄞", BinaryFormat->"UTF16")
'y\0ä\0¬ 4Ø\x1EÝ'
ToString('y\0\0\0ä\0\0\0¬ \0\0\x1EÑ\x01\0', BinaryFormat->"UTF32")
"yä€𝄞"
ToString(10000, DigitBase->2)
"10011100010000"
ToString(10^100, DigitBase->36)
"2HQBCZU2OW52BALA8LGC3S5Y9MM5TIY0VO9TKE25466GFI6AX8GS22X7KUU8L1TDS"
ToString(1024.0625, DigitBase->16)
"400.1000000000"
ToString(123456, BinaryFormat->"Integer32")
'@â\x01\0'
ToString(3.1415, BinaryFormat->"Real64")
'o\x12\x83ÀÊ!\t@'
ToSymbol("var")
var
a = 123;
ToSymbol("a")
123
b = "al"; c = "pha"; alpha = 456;
b~c
"alpha"
ToSymbol(b~c)
456
ToSymbol("3a")
ToSymbol("3a")
ToSymbol("no-var")
ToSymbol("no-var")
True
1 == 1
True
Not(True)
False
Trunc(x)
Trunc(-2.1)
-2
Trunc(2.9)
2
Trunc(-13/8)
-1
Trunc(1.2 + 3.8*I)
1+3*I
Trunc(Log(10))
2
Trunc(Overflow)
Overflow
Trunc(Underflow)
0
Trunc(-Underflow)
0
Underflow
Exp(-10.0^20.0)
Underflow
3.14 + Underflow
3.14
Underflow * (-2)
-Underflow
3.14 / Underflow
Overflow
Log(Underflow)
-Overflow
1 != 2
True
1 != Pi != 3.0
True
1 != 1.0
1 === 1.0
False
False
1 != 2 != 1
False
a != b
a != b
1.0000000000000000002 != 1.0000000000000000001
False
1.00000000000000000020 != 1.00000000000000000010
True
Union(list)
Union(list1, list2, … )
Union( {4,3,3,1} )
{1, 3, 4}
Union( {4,3,3,1} , {2,4,4,5} )
{1, 2, 3, 4, 5}
Union( {4,3,3,1} , {2,3.0} , {x} )
{1, 2, 3, 3.0, 4, x}
Union( a + b , a + c + d )
a + b + c + d
Union( f(1, 2), f(2, 3) )
f(1, 2, 3)
Union( f(1, 2), g(2, 3) )
Union(f(1, 2), g(2, 3))
Xor(bool1, bool2, … )
bool1 !! bool2 !! …
Xor(int1, int2, … )
int1 !! int2 !! …
Xor(str1, str2, … )
str1 !! str2 !! …
True !! True
True !! True !! True
False
True
12 !! 7
11
'BINARY' !! 'abc'
'#+-ARY'
True !! a > 0
a <= 0
True !! a > 0 !! True
a > 0
Numbers | 123 , 3.14 | a sequence of decimal digits with an optional decimal point |
Operators | + , !=, -> | individual defined character groups |
Symbols | x , φ, var | a sequence of any unicode characters which are not defined as operator |
Strings | "yä€𝄞" , '\0\0\0ÿ' | a sequence of unicode or binary characters |
Expressions | head(arg1, arg2) | a function with a head and arguments |
Comments | /* no code */ | not interpreted code blocks |
f(x) | f(x) | Expressionf(…) |
f(x)(y) | (f(x))(y) | Expressionf(…) |
x[y] | Part(x, y) |
x[y][z] | Part(Part(x, y), z) |
x[y,z,…] | Part(x, y, z, …) |
{x, y, …} | List(x, y, …) |
"x" | String"…",'…' | |
'x' | String"…",'…' |
?h | Any(h) |
??h | AnySequence(h) |
???h | AnyNullSequence(h) |
s?h | Pattern(s, Any(h)) |
s??h | Pattern(s, AnySequence(h)) |
s???h | Pattern(s, AnyNullSequence(h)) |
f @ g @ x | f(g(x)) | Expressionf(…) |
x! | Factorial(x) |
x ~ y ~ … | Join(x, y, …) |
x ^ y ^ z | Power(x, Power(y, z)) |
x * y * … | Times(x, y, …) |
x / y / z | Divide(Divide(x, y), z) |
-x | Minus(x) |
x + y + … | Plus(x, y, …) |
x - y - z | Subtract(Subtract(x, y), z) |
x == y == … | Equal(x, y, …) |
x != y != … | Unequal(x, y, …) |
x < y < … | Less(x, y, …) |
x <= y <= … | LessEqual(x, y, …) |
x > y > … | Greater(x, y, …) |
x >= y >= … | GreaterEqual(x, y, …) |
x === y === … | Same(x, y, …) |
x .. y .. … | Span(x, y, …) |
!b | Not(b) |
x || y || … | Or(x, y, …) |
x && y && … | And(x, y, …) |
x !! y !! … | Xor(x, y, …) |
x | y | … | Alternatives(x, y, …) |
x /? y /? f | Condition(x, Condition(y, f)) |
x : y : z | Optional(Optional(x, y), z) |
x -> y -> z | Rule(x, Rule(y, z)) |
x :> y :> z | RuleDelayed(x, RuleDelayed(y, z)) |
x /: y /: z | Replace(Replace(x, y), z)) |
x // f // g | f(g(x)) | Expressionf(…) |
f /@ g /@ x | Map(f, Map(g, x)) |
f & | Function(f) |
x = y = z | Define(x, Define(y, z)) |
x := y := z | DefineDelayed(x, DefineDelayed(y, z)) |
x @= y @= z | SubDefine(x, SubDefine(y, z)) |
x @:= y @:= z | SubDefineDelayed(x, SubDefineDelayed(y, z)) |
x ; y ; … | Compound(x, y, …) |
x , y , … | Sequence(x, y, …) |