[GiNaC-list] question about quantum operator algebra
Canhua
dreameration at gmail.com
Tue May 8 05:18:18 CEST 2007
> Date: Sat, 5 May 2007 11:13:49 +0200 (CEST)
> From: Chris.Dams at mi.infn.it
> Subject: Re: [GiNaC-list] question about quantum operator algebra
> To: "GiNaC discussion list" <ginac-list at ginac.de>
> You can declare those operators as noncommutative symbols. I assume that
> you are using version 1.3.x. Then it goes as e.g.,
>
> const unsigned my_tinfo = 2;
> symbol a("a", return_types::noncommutative, my_tinfo);
> symbol adag("adag", return_types::noncommutative, my_tinfo);
> H = epsilon*adag*a;
> ex commu = a*H - H*a
> commu = rewrite_operators(commu);
>
> The global constant my_tinfo is arbitrary, but for safety it should not be
> one that is already in use (see
> http://www.ginac.de/viewcvs/GiNaC/ginac/tinfos.h?hideattic=0&rev=1.27.2.3&view=markup).
> You would have to define the function rewrite_operators yourself. It could
> be something like
>
> ex rewrite_operators(const ex &x)
> { if (is_a<ncmul>(x))
> { ... constructing the result of rewriting is done here ...
Sorry, but I have no idea what goes here. Could you show me somewhere
to find examples? Thank you.
> return result;
> }
> else
> return x.map(rewrite_operators);
> }
Best regards,
Can-Hua Chen
More information about the GiNaC-list
mailing list