Post by krusader74 on Aug 14, 2014 9:51:03 GMT -6
Uploaded build 30 of palamedes with the following changes:
See the NEWS for more details and examples. Or download the SOURCE code.
- Added a recur operator to generate recurrences. E.g., recur (_1+_2),[0,1] generates the Fibonacci sequence to ∞ which is set to 100 by default. The format is recur expr, initial where expr is an expression in parens. This expression may contain variables of the form _k which get set to result[n-k] where n is the number of results accumulated so far. And initial is the initial value of the result array. The expr has to be an actual expression -- it can't be a variable holding an expression, but this constraint may disappear in a future release. See the NEWS file for more examples.
- Added the sqrt function. This is different from root which is a dyadic operator rather than a function, e.g., 3 root 10 produces the cube root of 10. In general, functions need parens, operators don't. But the sqrt function is threadable over vectors/matrices/tensors, and parens are optional around things enclosed in square brackets, e.g., sqrt [0..4] is OK. TMTOWTDI: sqrt(2) produces the same result as 2 root 2 and √2 and 2^.5
- Added the trig reciprocal functions: cot, coth, csc, csch, sec, sech
- Added sign function to return the sign of a number: 1, 0 or -1.
- Added fix(x,n) function to display decimal numbers x with a fixed number n of decimal places. The number n defaults to 2. This function is threadable, so parens are optional around vectors and matrices as long as the default number of decimal places is used.
- Added size function to return the size of its input: 0 means its a scalar; a positive number n means its a vector of length n; and an array [m,n] means its a matrix with m rows and n columns. Additionally, -1 indicates its a JSON object; -2 indicates its a JavaScript function; and -3 indicates its type is unknown.
- Added trace function: tr. Input is a square matrix. Output is sum of diagonal elements. This is a non-threadable function--at most one input which must be in parens.
- Added the norm function to return the p-norm of a vector or matrix. By default, p is 2. But see the NEWS for more details.
- Fixed a minor bug that caused the output of while(a){b;c;d} to display as while(a){b,c,d} with commas instead of semicolons.
See the NEWS for more details and examples. Or download the SOURCE code.