Return the biggest value between a and b
$ eq eval "max( 2, 10.0 )"
10.0
Return the smallest value between the two elements
$ eq eval "min( 2, 10.0 )"
2
Perform a structural (deep) equality comparison
$ eq eval "eq( x + 3, x + 4 )"
false
$ eq eval "eq( x + 3, x + 3 )"
true
Return either then or else in function of the first argument. If it’s true, then it return then, if it’s false it return else. If it’s neither true or false, then it return undefined
$ eq eval "if( 3 > 4, lower, greater )"
greater
$ eq eval "if( 3 < 4, lower, greater )"
lower
$ eq eval "if( 3, lower, greater)"
undefined
Derivate order times the function with the given var
$ eq eval "derivaten( x ^ 4 + x ^ 3 / 2 + 15 * x, x, 1 )"
2
3 3.x
15 + 4.x + ------
2
$ eq eval "derivaten( x ^ 4 + x ^ 3 / 2 + 15 * x, x, 2 )"
2 6.x
12.x + -----
2
$ eq eval "derivaten( x ^ 4 + x ^ 3 / 2 + 15 * x, x, 3 )"
3
--- + 24.x
1
give the value of n modulo p
$ eq eval "modulo( 14, 3 )"
2
Return the taylor expansion of an expression. For exemple to get the taylor expansion of the formula sin(x) + x for the variable x and at 0, you should try :
$ eq exacteval "taylor( sin(x) + x, x, 0, 10 )"
1 5 1 9 1 3 1 7
2.x + -----.x + --------.x + ----.x + -------.x
120 362880 6 5040
Is just the functional version of the :: operator
Return the concatenation of two lists.
$ eq eval "concat([a, b, c], [1, 2, 3] )"
[ a, b, c, 1, 2, 3 ]
Return the list reversed
$ eq eval "reverse([a, b, c])"
[ c, b, a ]
Return the length (number of elements) of a list
$ eq eval "length([a, b, c, 10])"
4
Generate a list containing all the integer from beginning to end (included).
$ eq eval "listFromTo( 12, 30 )"
[ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 ]
Generate a list of numbers containing all the integers from beginning to end, each value separated by increment.
$ eq eval "listFromToBy( 12, 2, 30 )"
[ 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 ]
Remove all object which the function doesn’t evaluate to true.
$ eq eval "enough(x) :> x > 50; filter( enough, [100, 2, 4, 51, 50, 60 ] )"
[ 100, 51, 60 ]
Apply a function to all elements of the list
$ eq eval "mul2(x) :> x * 2; map( mul2, [1, 2, 3, 12] )"
[ 2, 4, 6, 24 ]
Function used to perform a left fold on a list. The function should take two parameters : one for an accumulator, and one for an element of the list.
The accumulator is carried over all the elements of the list, and the iterations start at the beginning of the list. One example of the use of fold is to write the equivalent of the reverse function using a left fold :
$ eq eval "foldl( cons, [], [1, 2, 3, 4] )"
[ 4, 3, 2, 1 ]
Same as the left fold, but here is the right fold, iterations start from the end of the list to the beginning.