new function full exp op n
Just a brief one. I don't currently have a use for it, but part of my brain says it might be useful. Yeah, I guess I am not a minimalist. Anyway, a tweak on exp[op,n], this time we keep the 1/factorial(k) factor.
So, simply enough:
maps to: (1 + op/1 + op^2/2 + ... + op^n/n! ) |x>
No point giving the python.
Anyway, a quick example:
-- define our X operator:
sa: X |*> #=> algebra(|x>,|*>,|_self>)
-- the previous exp operator:
sa: exp[X,6] |1>
|1> + |x> + |x*x> + |x*x*x> + |x*x*x*x> + |x*x*x*x*x> + |x*x*x*x*x*x>
-- the new exp operator:
sa: full-exp[X,6] |1>
|1> + |x> + 0.5|x*x> + 0.167|x*x*x> + 0.042|x*x*x*x> + 0.008|x*x*x*x*x> + 0.001|x*x*x*x*x*x>
And I guess that is it. We see the standard Taylor series for exp(x) as expected.
Update: and we can use exp as a "smear" operator, to expand a single point into a range of points. So, in a way, a little like the range function.
In the console:
-- define a translation operator:
T |*> #=> arithmetic(|_self>,|+>,|x: 1>)
-- a test case (translate by 1):
sa: T |x: 0>
-- another test case (translate by 7):
sa: T^7 |x: 0>
-- use exp[op,n] as a smear operator:
sa: exp[T,7] |x: 0>
|x: 0> + |x: 1> + |x: 2> + |x: 3> + |x: 4> + |x: 5> + |x: 6> + |x: 7>
previous: new function list kets
next: new function apply weights n1 n2
by Garry Morrison
email: garry -at- semantic-db.org