Next: Miscellaneous, Previous: Matrices and Tensors, Up: Top [Contents][Index]

- Operator:
**lambda***varlist expression* Jacal has the ability to work with lambda expressions, via the command

`lambda`

. Furthermore, Jacal always converts user definitions of functions by any method into lambda expressions and converts the dummy variables of the function definition into symbols such as`1`,`2`, …. Jacal can manipulate lambda expressions by manipulating their function parts, as in ‘`e14`’ below. Jacal can also invert a function using the command`finv`

.e12 : lambda([x],x^2); 2 e12: lambda([@1], @1 ) e13 : lambda([x,y,z],x*y*z); e13: lambda([@1, @2, @3], @1 @2 @3) e14 : e12+e13; 2 e14: lambda([@1, @2, @3], @1 + @1 @2 @3)

- Command:
**elementwise***function matrix1 matrix2 …* The arguments

`matrix1`,`matrix2`, … must have the same shape. The command`elementwise`

returns a new matrix formed by applying`function`to each tuple of elements of`matrix1`,`matrix2`, ….e9 : elementwise(foo,[a, b], [c, d]); e9: [foo(a, c), foo(b, d)] e10 : elementwise(@1+5*@2,[a, b], [c, d]); e10: [a + 5 c, b + 5 d] e1 : elementwise(@1-@2,[9,8,7],[[1,0],[4,5],[6,3]]); [ 8 9 ] [ ] e1: [ 4 3 ] [ ] [ 1 4 ]

- Command:
**finv***function* `function`^^-1The command

`finv`

takes as input a function of one variable and returns the inverse of that function. The function may be defined in any of the ways permitted in Jacal, i.e. by an explicit algebraic definition, by an explicit lambda expression or by an implicit lamba expression. If`f`is the function, then typing`f^^-1`

has the same effect as typing`finv(`

.`f`)e0 : w(t):=t+1; w(t): lambda([@1], 1 + @1) e0 : finv(w); e0: lambda([@1], -1 + @1)

Next: Miscellaneous, Previous: Matrices and Tensors, Up: Top [Contents][Index]