On Tue, 9 Mar 2010, Raoul wrote:
< Hi all,
<
< > < For the case of a geometric algebra the basic simplification rules
< > < are pretty clear:
< > <
< > < i) tellsimp (X^^i, X^mod(i,2));
< > < ii) tellsimp (W.(Y.Z),(W.Y).Z);
< > < ii) tellsimp (e[i] . e[j], -e[j] . e[i]);
< > <
< > < But in my case I only know the commutator of the two operators:
< > <
< > < [R,L] = 1
< > <
< > < So I do not see a rule of type i). Also, how should I write the
< > associativity < in ii)? The only I can do is a rule of type iii).
< > <
< > < Maybe I could figure out some rules for R^^i.L^^j and L^^i.R^^j but
< > < will this help in any way? All mathematical information is already
< > < in the commutation relation.
< >
< > Indeed, you can see that a rule
< >
< > tellsimp(R.L,1+L.R);
< > tellsimp(R^^i . L, 1+(R^^(i-1) . L) . R);
< >
< > will recursively implement the bracket relations.
<
< Yes. I figured out some rules but a small issue remains.
<
< > < > For your second question,
< > < Finally I would like to be able to write things like R.R.L.L.ket(n)
< > < and even (R+L)^^4.ket(n).
< >
< > Try:
< >
< > declare(h,integer);
< > declare(h,scalar);
< > matchdeclare(m,lambda([t],featurep(t,integer)),n,lambda([t],featurep(t,integer)),u,scalarp);
< > tellsimp(L.ket(n), sqrt(n)*ket(n-1));
< > tellsimp(L.(u*ket(n)), u*sqrt(n)*ket(n-1));
< > tellsimp(L^^m . (u*ket(n)), u*sqrt(n)*(L^^(m-1) . ket(n-1)));
< > tellsimp(R.ket(n), sqrt(n+1)*ket(n+1));
< > tellsimp(R.(u*ket(n)), u*sqrt(n+1)*ket(n+1));
< > tellsimp(R^^m . (u*ket(n)), u*sqrt(n+1)*(R^^(m-1) . ket(n+1)));
<
< The rule set I have right now is (omitted some declare statements):
<
< matchdeclare(m,lambda([t],featurep(t,integer)));
< matchdeclare(n,lambda([t],featurep(t,integer)));
< matchdeclare(k,lambda([t],featurep(t,integer)));
< tellsimp(bra(m).ket(n), kron_delta(m,n)); /* Basic rule for bra and ket */
< tellsimp(I.ket(n), ket(n)); /* operator definitions */
< tellsimp(L.ket(n), sqrt(n)*ket(n-1));
< tellsimp(R.ket(n), sqrt(n+1)*ket(n+1));
< dotscrules:true; /* allows to pull scalars out*/
< tellsimp((L^^k).ket(n), (L^^(k-1)).(L.ket(n))); /* reduce powers */
< tellsimp((R^^k).ket(n), (R^^(k-1)).(R.ket(n)));
< tellsimp(I^^k, I);
< tellsimp(((L.R)^^k).ket(n), ((L.R)^^(k-1)).(L.R.ket(n))); /* some rules for mixed powers */
< tellsimp(((R.L)^^k).ket(n), ((R.L)^^(k-1)).(R.L.ket(n)));
< tellsimp(R.L, L.R-I); /* commutation relation */
<
< These are mostly the same you propse. For the problem with the scalars I found the
< flag "dotscrules" which does exactly what I want.
Interesting, I wrote the scalar simplification rules because dotscrules
does not do what is wanted (v5.19.2), as it causes ket(n) to be treated
as a scalar.
<
<
< Now, one more thing I still would like to do is general "operator polynomial" simplification.
< Let me give an example which works out of the box:
<
< (%i28) (L.R.L.R)^^2 .ket(j);
< 4
< (%o28) (j + 1) ket(j)
<
< And one which does not:
<
< (%i29) (R.R.L.R)^^2 .ket(j);
< <2> <2>
< (%o29) (R . L . R) . ket(j)
<
I ought to have added this in my earlier post. Here is a
general purpose function that will do what you want:
(%o11) fullexpand(expr,[maxdepth]):=block([expr0:0],
maxdepth:if maxdepth = [] then 100 else part(maxdepth,1),
for i while i < maxdepth and expr0 # expr do
[expr0,expr]:[expr,expand(expr)],expr)
(%i12)
(%o12) (R . R . L . R)^^2 . ket(h)
(%i13)
(%o13) h^2*sqrt(h+1)*sqrt(h+2)*sqrt(h+3)*sqrt(h+4)*ket(h+4)
+4*h*sqrt(h+1)*sqrt(h+2)*sqrt(h+3)*sqrt(h+4)*ket(h+4)
+3*sqrt(h+1)*sqrt(h+2)*sqrt(h+3)*sqrt(h+4)*ket(h+4)
collectterms(%,ket(h+4));
will group all the coefficients together.
Leo
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.