operator: exp
description:
exp[op, n] |x>
essentially the first n terms of exp(op) applied to |x>, ignoring factors of 1/n!
if you want the 1/n! too, then see full-exp
cf: exp(A) |Psi> in quantum mechanics
ie: (1 + op + op^2 + ... + op^n) |x>
if n <= 0, return |x>
examples:
-- load a binary tree:
load tree.sw
-- find left branch of tree:
exp[left, 3] |x>
|x> + |0> + |00> + |000>
-- find right branch of tree:
-- NB: in this case exp[right, 4] would have sufficed
exp[right, 10] |x>
|x> + |1> + |11> + |111> + |1111>
-- find the head of the tree:
exp[child, 2] |x>
|x> + |0> + |1> + |00> + |01> + |10> + |11>
see also:
full-exp, exp-max, sexp
TODO:
currently it doesn't handle sequences all that well.
Home