certainly
The "boolean" \(certainly\) value (almost certain)
Notes:
Examples:
\(certainly\)
e
The \(e\) value
Notes:
- The precision of the value is the current significand precision
- The power of e (for instance e^x) is equivalent to the function exp(x)
Examples:
\(e\)
i
The complex \(i\)
Notes:
Examples:
\(i, 1+2*i\)
j
The quaternion part \(j\)
Notes:
Examples:
\(j, 1+2*i+3*j\)
k
The quaternion part \(k\)
Notes:
Examples:
\(j, 1+2*i+3*j+4*k\)
maybe
The "boolean" \(maybe\) value (totally uncertain)
Notes:
Examples:
\(maybe\)
no, false
The boolean \(no\) value
Notes:
Examples:
\(no, false\)
pi, π
The \(\pi\) value
Notes:
- The precision of the value is the current significand precision
Examples:
\(pi, \pi\)
unlikely
The "boolean" \(unlikely\) value (almost \(no\))
Notes:
Examples:
\(unlikely\)
yes, true
The boolean \(yes\) value
Notes:
Examples:
\(yes, true\)
°, °?
Converts degrees to radians
Notes:
- It simply multiplies by \(\frac{\pi}{180}\)
- It is only useful to simplify use of degrees for trignonometry functions
- The convenient operator °? can be used when operands are not mathematically compatible, but the result is driven by common sense, like a matrix
Examples:
\(45°, \sin\left(45°\right), \left(\begin{matrix}1 & 2\\3 & 4\\\end{matrix}\right)°? \)
+/-, ±
Creates uncertainty
Notes:
- Using \(x±d\) is equivalent to the function \(interval(x, d, 0)\)
- Only reals are supported. Even integer operands are converted to reals
- See operators %, ‰, ‱ and ppm to see how uncertainty can be expressed relatively
Examples:
\(1\textrm{+/-}2, 1±2\)
:=, ::=
Assigns a value to a variable
Notes:
- The ::= version instead of := sets the variable to "dynamic". A dynamic variable is automatically updated when it is dependent on other variables values.
- The := operator can also be used to send data to a file.
Examples:
\(x := 1, y ::= 2, \textrm{outfile}(\textrm{"a file"}) := 345\)
+, +?
Adds two values
Notes:
- The operands can be of any type as long as it is mathematically valid (scalars, complexes, quaternions, matrices...)
- The convenient operator +? can be used when operands are not mathematically compatible, but the result is driven by common sense, like a scalar and a matrix
Examples:
\(1+2, \left(\begin{matrix}1 & 2\\3 & 4\\\end{matrix}\right)+\left(\begin{matrix}5 & 6\\7 & 8\\\end{matrix}\right),~1~+? \left(\begin{matrix}2 & 3\\4 & 5\\\end{matrix}\right) \)
-, -?
Subtract two values
Notes:
- The operands can be of any type as long as it is mathematically valid (scalars, complexes, quaternions, matrices...)
- The convenient operator -? can be used when operands are not mathematically compatible, but the result is driven by common sense, like a scalar and a matrix
Examples:
\(1-2, \left(\begin{matrix}1 & 2\\3 & 4\\\end{matrix}\right)-\left(\begin{matrix}5 & 6\\7 & 8\\\end{matrix}\right),~1~-? \left(\begin{matrix}2 & 3\\4 & 5\\\end{matrix}\right) \)
*, *?
Multiples two values
Notes:
- The operands can be of any type as long as it is mathematically valid (scalars, complexes, quaternions, matrices...)
- The convenient operator *? can be used when operands are not mathematically compatible, but the result is driven by common sense, like when you want the operation to be applied element-by element for two matrices of the same size.
Examples:
\(1*2, \left(\begin{matrix}1 & 2\\3 & 4\\\end{matrix}\right)*\left(\begin{matrix}5 & 6\\7 & 8\\\end{matrix}\right),~\left(\begin{matrix}1\\2\end{matrix}\right)*?\left(\begin{matrix}3\\4\end{matrix}\right) \)
/, /?
Divides two values
Notes:
- The operands can be of any type as long as it is mathematically valid (scalars, complexes, quaternions, matrices...)
- for quaternions, this notation is ambiguous and is provided for convenience. In Chalk, \(q/r\) is computed as \(q*{r^{-1}}\), not as \(r^{-1}*q)\)
- The convenient operator /? can be used when operands are not mathematically compatible, but the result is driven by common sense, like when you want the operation to be applied element-by-element for two matrices of the same size.
Examples:
\(1*2, \left(\begin{matrix}1 & 2\\3 & 4\\\end{matrix}\right)*\left(\begin{matrix}5 & 6\\7 & 8\\\end{matrix}\right),~\left(\begin{matrix}1\\2\end{matrix}\right)/?\left(\begin{matrix}3\\4\end{matrix}\right) \)
^, **, ^?, **?
Power of a value
Notes:
- The operands can be of any type as long as it is mathematically valid (scalars, complexes, quaternions, matrices...)
- The convenient operator ^? or **? can be used when operands are not mathematically compatible, but the result is driven by common sense, like when you want the operation to be applied element-by element for two matrices of the same size.
Examples:
\(\textrm{1^2}, \textrm{1**2}, ~\left(\begin{matrix}1\\2\end{matrix}\right)\textrm{^?}\left(\begin{matrix}3\\4\end{matrix}\right) \)
>, >?
Compares two values (strictly greater than)
Notes:
- The operands can be of any type as long as it is mathematically valid (scalars, complexes, quaternions, matrices...)
- The convenient operator >? can be used when operands are not mathematically compatible, but the result is driven by common sense, like when you want the operation to be applied element-by-element for two matrices of the same size.
Examples:
\(1>2,1.2>3.456,~1±3>1±2,~\left(\begin{matrix}1 & 2\\3 & 4\\\end{matrix}\right)>?2,~\left(\begin{matrix}1\\2\end{matrix}\right)>?\left(\begin{matrix}3\\4\end{matrix}\right) \)
>=, >=?, ≥, ≥?
Compares two values (greater than or equal)
Notes:
- The operands can be of any type as long as it is mathematically valid (scalars, complexes, quaternions, matrices...)
- The convenient operator ≥? can be used when operands are not mathematically compatible, but the result is driven by common sense, like when you want the operation to be applied element-by-element for two matrices of the same size.
Examples:
\(1>=2,1.2≥3.456,~1±3>=1±2,~\left(\begin{matrix}1 & 2\\3 & 4\\\end{matrix}\right)>=?2,~\left(\begin{matrix}1\\2\end{matrix}\right)>=?\left(\begin{matrix}3\\4\end{matrix}\right) \)
<, <?
Compares two values (strictly lower than)
Notes:
- The operands can be of any type as long as it is mathematically valid (scalars, complexes, quaternions, matrices...)
- The convenient operator <? can be used when operands are not mathematically compatible, but the result is driven by common sense, like when you want the operation to be applied element-by-element for two matrices of the same size.
Examples:
\(1<2,1.2<3.456,~1±3<1±2,~\left(\begin{matrix}1 & 2\\3 & 4\\\end{matrix}\right)<?2,~\left(\begin{matrix}1\\2\end{matrix}\right)<?\left(\begin{matrix}3\\4\end{matrix}\right) \)
<=, <=?, ≤, ≤?
Compares two values (lower than or equal)
Notes:
- The operands can be of any type as long as it is mathematically valid (scalars, complexes, quaternions, matrices...)
- The convenient operator ≤? can be used when operands are not mathematically compatible, but the result is driven by common sense, like when you want the operation to be applied element-by-element for two matrices of the same size.
Examples:
\(1<=2,1.2≤3.456,~1±3<=1±2,~\left(\begin{matrix}1 & 2\\3 & 4\\\end{matrix}\right)<=?2,~\left(\begin{matrix}1\\2\end{matrix}\right)<=?\left(\begin{matrix}3\\4\end{matrix}\right) \)
==, ==?
Compares equality of two values
Notes:
- The operands can be of any type as long as it is mathematically valid (scalars, complexes, quaternions, matrices...)
- The convenient operator ==? can be used when operands are not mathematically compatible, but the result is driven by common sense, like when you want the operation to be applied element-by-element for two matrices of the same size.
Examples:
\(1==2,1.2==3.456,~1±3==1±2,~\left(\begin{matrix}1 & 2\\3 & 4\\\end{matrix}\right)==?2,~\left(\begin{matrix}1\\2\end{matrix}\right)==?\left(\begin{matrix}3\\4\end{matrix}\right) \)
x%
used to express a per cent uncertainty
Parameters:
Notes:
Examples:
\(12±3\%, 12\textrm{+/-)3\%\)
x‰
used to express a per thousand uncertainty
Parameters:
Notes:
Examples:
\(12±3‰, 12\textrm{+/-}3‰\)
x‱
used to express a per ten thousand uncertainty
Parameters:
Notes:
Examples:
\(12±3‱, 12\textrm{+/-}3‱\)
xppm
used to express a per million uncertainty
Parameters:
Notes:
Examples:
\(12±3ppm, 12\textrm{+/-}3ppm\)
|x|
Returns the magnitude of a value.
Parameters:
- x : scalar, complex, quaternion or matrix.
Notes:
- The operator \(|\ldots|\) is equivalent to the \(abs{(\ldots)}\) function
- For complexes and quaternions, returns the norm (as expected);
- Matrices are supported for convenience and |…| is simply applied to all the elements separately.
Examples:
\(|1.234|,~|1+2*i|,~|1+2*i-3*j+4*k|,~\left|\left(\begin{matrix}1 & 2\\3 & 4\\\end{matrix}\right)\right|\)
\(abs(1.234),~abs(1+2*i),~abs(1+2*i-3*j+4*k),~abs\left(\begin{matrix}1 & 2\\3 & 4\\\end{matrix}\right)\)
x!
Returns the factorial of a value.
Parameters:
Examples:
\(5!\)
AND, &&, AND?, &&?
Logical AND between two booleans, or bitwise AND between raw values
Parameters:
Notes:
- Matrices are supported for convenience and the operator is simply applied to all the elements separately.
Examples:
\(x~AND~y, x~\&\&~y, \left(\begin{matrix}x & y\\z & t\\\end{matrix}\right)~AND?~\left(\begin{matrix}x & y\\z & t\\\end{matrix}\right)\)
NOT, NOT?
Logical NOT for a boolean, or complement to 1 for a raw value
Parameters:
Notes:
- Matrices are supported for convenience and the operator is simply applied to all the elements separately.
Examples:
\(NOT(x), NOT?~\left(\begin{matrix}x & y\\z & t\\\end{matrix}\right)\)
OR, ||;, OR?, ||?
Logical OR between two booleans, or bitwise OR between raw values
Parameters:
Notes:
- Matrices are supported for convenience and the operator is simply applied to all the elements separately.
Examples:
\(x~OR~y, x~||~y, \left(\begin{matrix}x & y\\z & t\\\end{matrix}\right)~OR?~\left(\begin{matrix}x & y\\z & t\\\end{matrix}\right)\)
XOR, ^^, XOR?, ^^?
Logical XOR between two booleans, or bitwise XOR between raw values
Parameters:
Notes:
- Matrices are supported for convenience and the operator is simply applied to all the elements separately.
- There is no ambiguity with the pow operator that is written ^ in Chalk
Examples:
\(x~XOR~y, x~\hat{}\hat{}~y, \left(\begin{matrix}x & y\\z & t\\\end{matrix}\right)~XOR?~\left(\begin{matrix}x & y\\z & t\\\end{matrix}\right)\)
~, ~?
Bitwise complement to 1 of a raw value, equivalent to NOT for booleans
Parameters:
Notes:
- Matrices are supported for convenience and the operator is simply applied to all the elements separately.
Examples:
\(\tilde{}x, \tilde{}?\left(\begin{matrix}x & y\\z & t\\\end{matrix}\right)\)
abs(x)
Returns the magnitude of a value.
Parameters:
- x : scalar, complex, quaternion or matrix.
Notes:
- The operator \(|\ldots|\) can be used instead of \(abs{(\ldots)}\)
- For complexes and quaternions, returns the norm (as expected);
- Matrices are supported for convenience and abs() is simply applied to all the elements separately.
Examples:
\(abs(1.234),~abs(1+2*i~),~abs(1+2*i-3*j+4*k~),~abs\left(\begin{matrix}1 & 2\\3 & 4\\\end{matrix}\right),~abs(\{1, 2, 3, 4\}) \)
acos(x)
Returns the arccosinus (in radians) of \(x\).
Parameters:
Notes:
- Matrices are supported for convenience, and the arccosinus is simply applied to every element, this is not a Taylor development.
Examples:
\(acos{(12.34)}, acos{\left(\begin{matrix}1&2\\3&4\end{matrix}\right)}\)
acosh(x)
Returns the hyperbolic arccosinus of \(x\).
Parameters:
Notes:
- Matrices are supported for convenience, and the hyperbolic arccosinus is simply applied to every element, this is not a Taylor development.
Examples:
\(acosh{(12.34)}, acosh{\left(\begin{matrix}1&2\\3&4\end{matrix}\right)}\)
angle(x)
Returns the argument (angle in radians) of a complex value \(x\).
Parameters:
Notes:
Examples:
\(angle{(12.34)}, angle{(12+34*i)}\)
angles(x)
Returns the euler angles (in radians) of a quaternion value \(x\).
Parameters:
Notes:
Examples:
\(angles{(12.34)}, angles{(12+34*i)}, angles{(1+2*i+3*j+4*k)}\)
asin(x)
Returns the arcsinus (in radians) of \(x\).
Parameters:
Notes:
- Matrices are supported for convenience, and the arcsinus is simply applied to every element, this is not a Taylor development.
Examples:
\(asin{(12.34)}, asin{\left(\begin{matrix}1&2\\3&4\end{matrix}\right)}\)
asinh(x)
Returns the hyperbolic arcsinus of \(x\).
Parameters:
Notes:
- Matrices are supported for convenience, and the hyperbolic arcsinus is simply applied to every element, this is not a Taylor development.
Examples:
\(asinh{(12.34)}, asinh{\left(\begin{matrix}1&2\\3&4\end{matrix}\right)}\)
atan(x)
Returns the arctangent (in radians) of \(x\).
Parameters:
Notes:
- Matrices are supported for convenience, and the arctangent is simply applied to every element, this is not a Taylor development.
Examples:
\(atan{(12.34)}, atan{\left(\begin{matrix}1&2\\3&4\end{matrix}\right)}\)
atan(y, x)
Returns the arctangent (in radians) of the point \((x, y)\).
Parameters:
Notes:
- y, x are specified in that order, like the usual atan2() function of programming langages
Examples:
\(atan2{(12, 34)}\)
atanh(x)
Returns the hyperbolic arctangent of \(x\).
Parameters:
Notes:
- Matrices are supported for convenience, and the hyperbolic arctangent is simply applied to every element, this is not a Taylor development.
Examples:
\(atanh{(12.34)}, atanh{\left(\begin{matrix}1&2\\3&4\end{matrix}\right)}\)
binomial(n, k)
Returns the binomial coefficients \({n \choose k}\) of a value, for
n and
k positive integers.
Parameters:
- n : integer
- k : positive integer
Notes:
- Negative values of \(n\) are supported, so that \({-n \choose k} = (-1)^k{n+k-1 \choose k}\)
Examples:
\(binomial(1, 2)\)
bits_concat_be(x,...)
concatenates all arguments at the bit level, big endian style
Parameters:
Notes:
- There can be any number of arguments
- "big endian" means that the first argument will be he most significand bits of the results. However, the bits of the argument itself are not rearranged
- if an argument is a list, it is automatically split
- all arguments must be raw values with a know bit size, but not necessarily the same
- the result is always defined by default as an unsigned integer, which bit size if the sum of all the arguments bit sizes
Examples:
\(\textrm{bits_concat_be}(ToU8(123), ToU32(\{456, 789\}))\)
bits_concat_le(x,...)
concatenates all arguments at the bit level, little endian style
Parameters:
Notes:
- There can be any number of arguments
- "little endian" means that the first argument will be he least significand bits of the results. However, the bits of the argument itself are not rearranged
- if an argument is a list, it is automatically split
- all arguments must be raw values with a know bit size, but not necessarily the same
- the result is always defined by default as an unsigned integer, which bit size if the sum of all the arguments bit sizes
Examples:
\(\textrm{bits_concat_le}(ToU8(123), ToU32(\{456, 789\}))\)
bits_reverse(x)
reverse the bits of the argument
Parameters:
Notes:
- When the argument is a list, the reverse operation is applied for convenience to every element of the list; it does not change the order of the elements in the list.
Examples:
\(\textrm{bits_reverse}(ToU8(123)), \textrm{bits_reverse}(ToU32(\{456, 789\}))\)
∛(x), cbrt(x)
Returns \(\sqrt[3]{x}\), the cube root of \(x\).
Parameters:
Notes:
Examples:
\(cbrt(123)\), \(∛(123)\)
cbrt(x), ∛(x)
Returns \(\sqrt[3]{x}\), the cube root of \(x\).
Parameters:
Notes:
Examples:
\(cbrt(123)\), \(∛(123)\)
ceil(x)
Returns the integer rounding of \(x\) towards \(+\infty\).
Parameters:
Notes:
- Rounding towards \(-\infty\) is \(floor(x)\)
Examples:
\(ceil(1.3)\), \(ceil(3/4)\), \(ceil(-pi)\)
cos(x)
Returns the cosinus of \(x\) (in radians).
Parameters:
Notes:
- Matrices are supported for convenience, and the cosinus is simply applied to every element, this is not a Taylor development.
- The operator ° can be used to enter x in degrees
Examples:
\(\cos{(12.34)}, \cos{(90°)}, \cos{\left(\begin{matrix}1&2\\3&4\end{matrix}\right)}\)
cosh(x)
Returns the hyperbolic cosinus of \(x\).
Parameters:
Notes:
- Matrices are supported for convenience, and the hyperbolic cosinus is simply applied to every element, this is not a Taylor development.
Examples:
\(\cosh{(12.34)}, \cosh{\left(\begin{matrix}1&2\\3&4\end{matrix}\right)}\)
conj(x)
Returns the conjugate of a quaternion \(x\).
Parameters:
Notes:
- Of course, real and complexes are supported.
Examples:
\(conj{(1+2*i+3*j+4*k)}, conj{\left(\begin{matrix}1&2+i\\3+j&4+k\end{matrix}\right)}\)
det(M)
Returns the determinant of a matrix M.
Parameters:
Notes:
- scalars are supported for convenience
Examples:
\(det{(1)}, det\left(\begin{matrix}1 & 2\\3 & 4\end{matrix}\right)\)
exp(x)
Returns the exponential of
x.
Parameters:
Notes:
- Complex values are supported, so that \(e^{i\theta} = \cos\theta+i\sin\theta\)
- The function exp(x) is equivalent to e^x (power of constant \(e\))
Examples:
\(exp(1), exp(1+2*i)\)
fibonacci(n)
Returns the \(n^{th}\) Fibonacci number.
Parameters:
Notes:
Examples:
\(fibonacci(123)\)
floor(x)
Returns the integer rounding of \(x\) towards \(-\infty\).
Parameters:
Notes:
- Rounding towards \(+\infty\) is \(ceil(x)\)
Examples:
\(floor(1.3)\), \(floor(3/4)\), \(floor(-pi)\)
fromBase(x, b)
Force the interpretation of \(x\) in base \(b\).
Parameters:
Notes:
- If the number has a valid base prefix or suffix, it will prevent the interpretation in the specified base \(b\)
Examples:
\(fromBase{(100, 16)}\)
fromU8(x)
converts from unsigned 8 bits integer.
Parameters:
Notes:
Examples:
\(fromU8(x)\)
fromS8(x)
converts from signed 8 bits integer.
Parameters:
Notes:
- sign bit is the most significand bit.
Examples:
\(fromS8(x)\)
fromU16(x)
converts from unsigned 16 bits integer.
Parameters:
Notes:
Examples:
\(fromU16(x)\)
fromS16(x)
converts from signed 16 bits integer.
Parameters:
Notes:
- sign bit is the most significand bit.
Examples:
\(fromS16(x)\)
fromU32(x)
converts from unsigned 32 bits integer.
Parameters:
Notes:
Examples:
\(fromU32(x)\)
fromS32(x)
converts from signed 32 bits integer.
Parameters:
Notes:
- sign bit is the most significand bit.
Examples:
\(fromS32(x)\)
fromU64(x)
converts from unsigned 64 bits integer.
Parameters:
Notes:
Examples:
\(fromU64(x)\)
fromS64(x)
converts from signed 64 bits integer.
Parameters:
Notes:
- sign bit is the most significand bit.
Examples:
\(fromS64(x)\)
fromU128(x)
converts from unsigned 128 bits integer.
Parameters:
Notes:
Examples:
\(fromU128(x)\)
fromS128(x)
converts from signed 128 bits integer.
Parameters:
Notes:
- sign bit is the most significand bit.
Examples:
\(fromS128(x)\)
fromU256(x)
converts from unsigned 256 bits integer.
Parameters:
Notes:
Examples:
\(fromU256(x)\)
fromS256(x)
converts from signed 256 bits integer.
Parameters:
Notes:
- sign bit is the most significand bit.
Examples:
\(fromS256(x)\)
fromF16(x)
converts from IEEE754 16 bits float.
Parameters:
Notes:
- 1 sign bit, 5 exponent bits, 10 significand bits
Examples:
\(fromF16(x)\)
fromF32(x)
converts from IEEE754 32 bits float.
Parameters:
Notes:
- 1 sign bit, 8 exponent bits, 23 significand bits
Examples:
\(fromF32(x)\)
fromF64(x)
converts from IEEE754 64 bits float.
Parameters:
Notes:
- 1 sign bit, 11 exponent bits, 52 significand bits
Examples:
\(fromF64(x)\)
fromF128(x)
converts from IEEE754 128 bits float.
Parameters:
Notes:
- 1 sign bit, 5 exponent bits, 112 significand bits
Examples:
\(fromF128(x)\)
fromF256(x)
converts from IEEE754 256 bits float.
Parameters:
Notes:
- 1 sign bit, 19 exponent bits, 236 significand bits
Examples:
\(fromF256(x)\)
gamma(x)
Returns the Gamma function result of \(x\).
Parameters:
Notes:
- Matrices are supported for convenience, and the gamma value is simply applied to every element.
Examples:
\(gamma{(12.34)}, gamma{\left(\begin{matrix}1&2\\3&4\end{matrix}\right)}\)
gcd(n, m)
Returns the greatest common divisor of \(n\) and \(m\).
Parameters:
Notes:
- Negative values are supported.
- Matrices are supported for convenience, and the gcd is simply applied to every element.
Examples:
\(gcd(12, 34)\)
golomb_rice_decode(x,[rice=0])
decompress a golomb bit stream, with optional rice encoding
Parameters:
- x : raw value or list of raw values
- rice : if 0, no rice encoding, otherwise the rice parameter
Notes:
- the output is a list of unsigned values;
- inexact flag is raised if some bits are missing.
Examples:
\(\textrm{golomb_rice_decode}(ToU32({123, 456})), \textrm{golomb_rice_decode}(ToU32({123, 456}), 8)\)
golomb_rice_encode(x,[rice=0])
compress a golomb bit stream, with optional rice encoding
Parameters:
- x : raw value or unsigned integer value, or list of such values
- rice : if 0, no rice encoding, otherwise the rice parameter
Notes:
- the output is a single raw value with exact bit count.
Examples:
\(\textrm{golomb_rice_encode}(123)), \textrm{golomb_rice_encode}({123, 456, 789}), 8)\)
hconcat(M,...)
Concatenates matrices horizontally.
Parameters:
Notes:
- Matrices must have the same row count;
- Lists are supported for convenience and are automatically split.
Examples:
\(hconcat{(M1)}, hconcat{(M1, M2)}, hconcat{(\{M1, M2\})}\)
identity(n)
Builds the identity matrix \(n\times n\).
Parameters:
Notes:
Examples:
\(identity(12)\)
interval(x, d[, direction=0])
Builds an interval around x.
Parameters:
- x : real
- d : real
- direction : -1, 0 or 1
Notes:
- direction = -1 builds the interval [x-d;x]
- direction = 0 builds the interval [x-d;x+d]
- direction = 1 builds the interval [x;x+d]
Examples:
\(interval(1,2), interval(1,-2), interval(1,2,1)\)
infile(url)
takes the content from the location \(url\).
Parameters:
Notes:
- the url can be an Unix file path or a full URL
Examples:
\(infile(\textrm{'/home/Desktop/toto.txt'}), infile(\textrm{'file:///home/Desktop/toto.txt'}), infile(\textrm{'http://host/location/page.txt'})\)
input(n)
takes the input (string) from the \(n^{th}\) previous computation.
Parameters:
Notes:
- Note that the index of the computations are displayed in the upper-left gray bubble of each item, and that this is a reverse order so that input(1) is always the last computation.
Examples:
\(input(1)\)
integral(expression, identifier, inf, sup, step)
Returns an approximation of \(\int_{inf}^{sup}{(expression)}\).
Parameters:
- expression : an expression that can be evaluated
- identifier : an identifier
- inf : a real number
- sup : a real number
- step : a real number
Notes:
- It is required that inf ≤ sup, and step > 0
Examples:
\(integral(sqrt(x), x, 0, 1, 0.01)\)
invert(M)
Return the invert of a matrix M.
Parameters:
Notes:
- scalars are supported for convenience an returns \(\frac{1}{x}\)
Examples:
\(invert{(1)}, invert\left(\begin{matrix}1 & 2\\3 & 4\end{matrix}\right)\)
isprime(n[, algorithm=0])
tells if \(n\) is a prime number
Parameters:
- n : integer
- algorithm : 0, 1, 2, 3, 4 or 5
Notes:
- The answer can be no, yes, certainly for a probabilistic test, maybe if it is out of the range of the selected algorithm.
- negative values are supported for convenience
- Possibles algorithm are
- 0 : best combination of the following algorithms
- 1 : use only the precomputed primes set embedded in Chalk
- 2 : use a standard Miller Rabin probabilistic test
- 3 : use an enforced Miller Rabin probabilistic test
- 4 : use a Miller Rabin deterministic test
- 5 : use a totally recreative and useless AKS implementation
Examples:
\(isprime(12345), isprime(12345,4)\)
jacobi(n, m)
Returns the jacobi symbol of \(n\) and \(m\).
Parameters:
- n : integer
- m : odd integer
Notes:
- Negative values are supported.
Examples:
\(jacobi(1, 3)\)
lcm(n, m)
Returns the lowest common multiple of \(n\) and \(m\).
Parameters:
Notes:
- Negative values are supported.
- Matrices are supported for convenience, and the lcm is simply applied to every element.
Examples:
\(lcm(12, 34)\)
ln(x)
Returns the natural logarithm of
x (base
e).
Parameters:
Notes:
Examples:
\(\ln(123)\)
log10(x)
Returns the 10-based logarithm of
x.
Parameters:
Notes:
Examples:
\(\log_{10}(123)\)
{..., ...}
Builds a list
Notes:
Examples:
{1, 2, 3, 4, 5, 6}
((..., ...)(..., ...) ...)
Builds a matrix (by rows)
Notes:
- The rows must have the same size
Examples:
\(((1,2,3)(4,5,6))\)
matrix(n, m[, defaultValue=0])
Builds a matrix \(n\times m\) (n rows, m columns)
Parameters:
- n : positive integer
- m : positive integer
- defaultValue : scalar
Notes:
Examples:
\(matrix(12, 34), matrix(12, 34, 5)\)
mod(x, y)
Returns the remainder of \(x\) modulo \(y\).
Parameters:
Notes:
- Negative values are supported, but the result is always positive
- Uncertainty is not supported for y
- Matrices are supported for convenience, and the modulo is simply applied to every element.
Examples:
\(mod(123, 4)\), \(mod(123.4, 56)\), \(mod(\frac{123}{4}, \frac{5}{6})\)
nextprime(n[, algorithm=0])
returns the prime following \(n\).
Parameters:
- n : positive integer
- algorithm : 0, 1, 2, 3, 4 or 5
Notes:
- if \(n\) is already prime, the next prime is returned, not \(n\)
- if the answer is probabilistic, an inexact flag is raised
- Possibles algorithms are
- 0 : best combination of the following algorithms
- 1 : use only the precomputed primes set embedded in Chalk
- 2 : use a standard Miller Rabin probabilistic test
- 3 : use an enforced Miller Rabin probabilistic test
- 4 : use a Miller Rabin deterministic test
- 5 : use a totally recreative and useless AKS implementation
Examples:
\(nextprime(12345), nextprime(12345,4)\)
nthprime(n[, algorithm=0])
returns the \(n^{th}\) prime.
Parameters:
- n : positive integer
- algorithm : 0, 1, 2, 3, 4 or 5
Notes:
- if the answer is probabilistic, an inexact flag is raised
- Possibles algorithms are
- 0 : best combination of the following algorithms
- 1 : use only the precomputed primes set embedded in Chalk
- 2 : use a standard Miller Rabin probabilistic test
- 3 : use an enforced Miller Rabin probabilistic test
- 4 : use a Miller Rabin deterministic test
- 5 : use a totally recreative and useless AKS implementation
Examples:
\(nthprime(12345), nthprime(12345,4)\)
outfile(url)
writes the content to the location \(url\).
Parameters:
Notes:
- the url can be an Unix file path or a full URL
- only file URLs are supported, it is note possible to write to a remote location
Examples:
\(outfile(\textrm{'/home/Desktop/toto.txt'}), outfile(\textrm{'file:///home/Desktop/toto.txt'})\)
output(n)
takes the output (value) from the \(n^{th}\) previous computation.
Parameters:
Notes:
- Note that the index of the computations are displayed in the upper-left gray bubble of each item, and that this is a reverse order so that output(1) is always the last computation.
Examples:
\(output(1)\)
output2(n)
takes the secondary output (value) from the \(n^{th}\) previous computation.
Parameters:
Notes:
- the secondary output is the one added to the regular output if the bit manipulator has been used
- Note that the index of the computations are displayed in the upper-left gray bubble of each item, and that this is a reverse order so that output2(1) is always the last computation.
Examples:
\(output(1)\)
pow(x, y)
Returns \(x^y\).
Parameters:
- n : scalar (even complex or quaternion) or matrix
- m : integer, real or complex
Notes:
- The power operator \(x\hat{}y\) can be used instead of \(pow(x, y)\)
- Complex \(y\) power is only supported for real \(x\) operand.
Examples:
\(pow(12, -34),~pow(12, 3+4*i)\)
primes(n[, algorithm=0])
returns the prime decomposition of \(n\).
Parameters:
- n : positive integer
- algorithm : 0, 1, 2, 3, 4 or 5
Notes:
- a decomposition is a list of pairs, each pair being a prime and its power.
- if the answer is probabilistic, an inexact flag is raised
- Possibles algorithms are
- 0 : best combination of the following algorithms
- 1 : use only the precomputed primes set embedded in Chalk
- 2 : use a standard Miller Rabin probabilistic test
- 3 : use an enforced Miller Rabin probabilistic test
- 4 : use a Miller Rabin deterministic test
- 5 : use a totally recreative and useless AKS implementation
Examples:
\(primes(12345), primes(12345,4)\)
primorial(n)
Returns the primorial of \(n\) (product of primes ≤ \(n\)).
Parameters:
Notes:
Examples:
\(primorial(10)\)
product(expression, identifier, inf, sup)
Returns \(\prod_{identifier=inf}^{sup}{(expression)}\).
Parameters:
- expression : an expression that can be evaluated
- identifier : an identifier
- inf : an integer
- sup : an integer
Notes:
- It is required that inf ≤ sup
Examples:
\(product(1/(x^2), x, 1, 10)\)
roll(x, delta)
bitwise roll operator.
Parameters:
- x : raw value
- delta : integer
Notes:
- Roll occurs to the left for \(delta>0\) and to the right for \(delta<0\).
- No roll occurs for \(delta=0\)
Examples:
\(roll(x, 1), roll(x, -123)\)
root(x, n)
Returns \(\sqrt[n]{x}\), the \(n^{th}\) root of \(x\).
Parameters:
- x : positive real
- n : positive integer
Notes:
Examples:
\(root(12.34, 56)\)
shift(x, delta)
bitwise shift operator.
Parameters:
- x : raw value
- delta : integer
Notes:
- Shift occurs to the left for \(delta>0\) and to the right for \(delta<0\).
- No shift occurs for \(delta=0\)
Examples:
\(roll(x, 1), roll(x, -123)\)
sin(x)
Returns the sinus of \(x\) (in radians).
Parameters:
Notes:
- Matrices are supported for convenience, and the sinus is simply applied to every element, this is not a Taylor development.
- The operator ° can be used to enter x in degrees
Examples:
\(\sin{(12.34)}, \sin{(90°)}, \sin{\left(\begin{matrix}1&2\\3&4\end{matrix}\right)}\)
sinh(x)
Returns the hyperbolic sinus of \(x\).
Parameters:
Notes:
- Matrices are supported for convenience, and the hyperbolic sinus is simply applied to every element, this is not a Taylor development.
Examples:
\(\sinh{(12.34)}, \sinh{\left(\begin{matrix}1&2\\3&4\end{matrix}\right)}\)
√(x), sqrt(x)
Returns \(\sqrt{x}\), the square root of \(x\).
Parameters:
Notes:
Examples:
\(sqrt(12.34)\), \(√(12.34)\)
sqrt(x), √(x)
Returns \(\sqrt{x}\), the square root of \(x\).
Parameters:
Notes:
Examples:
\(sqrt(12.34)\), \(√(12.34)\)
sum(expression, identifier, inf, sup)
Returns \(\sum_{identifier=inf}^{sup}{(expression)}\).
Parameters:
- expression : an expression that can be evaluated
- identifier : an identifier
- inf : an integer
- sup : an integer
Notes:
- It is required that inf ≤ sup
Examples:
\(sum(1/(x^2), x, 1, 10)\)
swap(x, s)
swap packets pairs of given bit size.
Parameters:
- x : raw value
- s : positive integer
Notes:
- Each consecutive pairs of packets of bit size \(s\) each are swapped (8 is byte swap, 16 is word swap, for instance)
- The swaps occur from lowest significant bits to most significant ones. If there are remaining bits that do not have the size of two packets, they remain untouched, instead of using a virtual zero-filled space outside of bounds
- A packet bit size of 0 is a no-op
-
Examples:
\(swap(x, 1), swap(x, 8)\)
tan(x)
Returns the tangent of \(x\) (in radians).
Parameters:
Notes:
- Matrices are supported for convenience, and the tangent is simply applied to every element, this is not a Taylor development.
- The operator ° can be used to enter x in degrees
Examples:
\(\tan{(12.34)}, \tan{(45°)}, \tan{\left(\begin{matrix}1&2\\3&4\end{matrix}\right)}\)
tanh(x)
Returns the hyperbolic tangent of \(x\).
Parameters:
Notes:
- Matrices are supported for convenience, and the hyperbolic tangent is simply applied to every element, this is not a Taylor development.
Examples:
\(\tanh{(12.34)}, \tanh{\left(\begin{matrix}1&2\\3&4\end{matrix}\right)}\)
toU8(x)
converts to unsigned 8 bits integer.
Parameters:
Notes:
Examples:
\(toU8(123)\)
toS8(x)
converts to signed 8 bits integer.
Parameters:
Notes:
- sign bit is the most significand bit.
Examples:
\(toS8(123)\)
toU16(x)
converts to unsigned 16 bits integer.
Parameters:
Notes:
Examples:
\(toU16(123)\)
toS16(x)
converts to signed 16 bits integer.
Parameters:
Notes:
- sign bit is the most significand bit.
Examples:
\(toS16(123)\)
toU32(x)
converts to unsigned 32 bits integer.
Parameters:
Notes:
Examples:
\(toU32(123)\)
toS32(x)
converts to signed 32 bits integer.
Parameters:
Notes:
- sign bit is the most significand bit.
Examples:
\(toS32(123)\)
toU64(x)
converts to unsigned 64 bits integer.
Parameters:
Notes:
Examples:
\(toU64(123)\)
toS64(x)
converts to signed 64 bits integer.
Parameters:
Notes:
- sign bit is the most significand bit.
Examples:
\(toS64(123)\)
toU128(x)
converts to unsigned 128 bits integer.
Parameters:
Notes:
Examples:
\(toU128(123)\)
toS128(x)
converts to signed 128 bits integer.
Parameters:
Notes:
- sign bit is the most significand bit.
Examples:
\(toS128(123)\)
toU256(x)
converts to unsigned 256 bits integer.
Parameters:
Notes:
Examples:
\(toU256(123)\)
toS256(x)
converts to signed 256 bits integer.
Parameters:
Notes:
- sign bit is the most significand bit.
Examples:
\(toS256(123)\)
toF16(x)
converts to IEEE754 16 bits float.
Parameters:
Notes:
- 1 sign bit, 5 exponent bits, 10 significand bits
Examples:
\(toF16(123)\)
toF32(x)
converts to IEEE754 32 bits float.
Parameters:
Notes:
- 1 sign bit, 8 exponent bits, 23 significand bits
Examples:
\(toF32(123)\)
toF64(x)
converts to IEEE754 64 bits float.
Parameters:
Notes:
- 1 sign bit, 11 exponent bits, 52 significand bits
Examples:
\(toF64(123)\)
toF128(x)
converts to IEEE754 128 bits float.
Parameters:
Notes:
- 1 sign bit, 5 exponent bits, 112 significand bits
Examples:
\(toF128(123)\)
toF256(x)
converts to IEEE754 256 bits float.
Parameters:
Notes:
- 1 sign bit, 19 exponent bits, 236 significand bits
Examples:
\(toF256(123)\)
trace(M)
Returns the trace of a matrix M.
Parameters:
Notes:
- scalars are supported for convenience
Examples:
\(trace{(1)}, trace\left(\begin{matrix}1 & 2\\3 & 4\end{matrix}\right)\)
vconcat(M,...)
Concatenates matrices vertically.
Parameters:
Notes:
- Matrices must have the same column count;
- Lists are supported for convenience and are automatically split.
Examples:
\(vconcat{(M1)}, vconcat{(M1, M2)}, vconcat{(\{M1, M2\})}\)
zeta(x)
Returns the Zeta function result of \(x\).
Parameters:
Notes:
- Matrices are supported for convenience, and the zeta value is simply applied to every element.
Examples:
\(zeta{(12.34)}, zeta{\left(\begin{matrix}1&2\\3&4\end{matrix}\right)}\)