[GiNaC-list] Simplify clifford expresion: Works?
Javier Ros Ganuza
jros at unavarra.es
Tue May 29 15:21:50 CEST 2007
Thanks very much, I0m sorry it was my mistake :) (1/2 ->> numeric(1,2))
Javier
On Mon, 2007-05-28 at 12:27 +0400, Sheplyakov Alexei wrote:
> Hello!
>
> On Mon, May 28, 2007 at 09:44:44AM +0200, Javier Ros Ganuza wrote:
>
> > cout << "subs Rotation R * e00 * R^\\dag = " <<
> > canonicalize_clifford((R * e00 * clifford_star(R)).expand()) << endl;
> >
> > cout << "subs Rotation R * e00 * R^\\dag = " <<
> > canonicalize_clifford((R * e00 *
> > clifford_star(R)).expand()).subs(sin(wild())*cos(wild())==sin(2*wild())/2) << endl;
> >
> > cout << "subs Rotation R * e00 * R^\\dag = " <<
> > canonicalize_clifford((R * e00 *
> > clifford_star(R)).expand()).subs(sin(wild())*cos(wild())==sin(2*wild())/2,subs_options::algebraic) << endl;
> >
> > Gives no subs at all
> >
> > subs Rotation R * e00 * R^\dag = e~0*cos(1/2*theta)^2
> > +2*e~1*sin(1/2*theta)*cos(1/2*theta)-e~0*sin(1/2*theta)^2
> > subs Rotation R * e00 * R^\dag = e~0*cos(1/2*theta)^2
> > +2*e~1*sin(1/2*theta)*cos(1/2*theta)-e~0*sin(1/2*theta)^2
> > subs Rotation R * e00 * R^\dag = e~0*cos(1/2*theta)^2
> > +2*e~1*sin(1/2*theta)*cos(1/2*theta)-e~0*sin(1/2*theta)^2
>
> Interesting. This program works for me:
>
> $ cat substest.cpp
> #include <iostream>
> #include <stdexcept>
> #include <ginac/ginac.h>
> using namespace std;
> using namespace GiNaC;
>
> int main(int argc, char** argv) {
> symbol x("x"), p("p"), eps("eps");
> varidx mu(symbol("mu"), 4-2*eps),
> nu(symbol("nu"), 4-2*eps);
>
> ex test = dirac_gamma(mu)*dirac_gamma(nu)*sin(x/2)*cos(x/2)
> + lorentz_g(mu, nu)*pow(sin(x), 2);
> cout << test << " ==> " << endl;
> cout << test.subs(sin(wild())*cos(wild())==sin(2*wild())/2,
> subs_options::algebraic) << endl;
> return 0;
> }
> $ g++ substest.cpp -lginac
> $ ./a.out
> (gamma~mu*gamma~nu)*cos(1/2*x)*sin(1/2*x)+eta~mu~nu*sin(x)^2 ==>
> eta~mu~nu*sin(x)^2+1/2*(gamma~mu*gamma~nu)*sin(x)
> $ pkg-config --modversion ginac
> 1.3.7
>
> > I understand that
> >
> >
> > cout << "subs Rotation R * e00 * R^\\dag = " <<
> > canonicalize_clifford((R * e00 * clifford_star(R)).expand()) << endl;
> >
> > cout << "subs Rotation R * e00 * R^\\dag = " <<
> > canonicalize_clifford((R * e00 *
> > clifford_star(R)).expand()).subs(2*sin(1/2*theta)*cos(1/2*theta)==sin(theta)) << endl;
>
> In C[++] 1/2 means integer division, so 1/2*theta is zero. So your
> rule is subs(0==sin(theta))...
>
> > cout << "subs Rotation R * e00 * R^\\dag = " <<
> > canonicalize_clifford((R * e00 *
> > clifford_star(R)).expand()).subs(2*sin(1/2*theta)*cos(1/2*theta)==sin(theta),subs_options::algebraic) << endl;
> >
> >
> > Produces nonsense substitutions:
> >
> > subs Rotation R * e00 * R^\dag = -e~0*sin(1/2*theta)^2
> > +cos(1/2*theta)^2*e~0+2*cos(1/2*theta)*e~1*sin(1/2*theta)
> > subs Rotation R * e00 * R^\dag = -e~(sin(theta))*sin(1/2*theta)^2
> > +2*cos(1/2*theta)*e~1*sin(1/2*theta)+cos(1/2*theta)^2*e~(sin(theta))
> > subs Rotation R * e00 * R^\dag = -e~(sin(theta))*sin(1/2*theta)^2
> > +2*cos(1/2*theta)*e~1*sin(1/2*theta)+cos(1/2*theta)^2*e~(sin(theta))
>
> ... and you got exactly what you asked for: e~0 turned into
> e~(sin(theta)
>
> > For example: what does mean: -e~(sin(theta)) ?
>
> Something like \gamma~(4-2*eps) in dimensional regularisation? :)
>
> > Also in this simple expresion, even expand() is giving a bad result
> >
> > cout << "out: " << ((2*sin(1/2*theta)*cos(1/2*theta) + 1).expand()) <<
> > endl;
>
> Again, 1/2 is 0, so the expression is 1, ...
>
> > cout << "out: " << ((2*sin(1/2*theta)*cos(1/2*theta) +
> > 1).expand()).subs(2*sin(1/2*theta)*cos(1/2*theta)==sin(theta)) << endl;
>
> ... and the rule is to replace zero with sin(theta) ...
>
> > cout << "out: " << ((2*sin(1/2*theta)*cos(1/2*theta) +
> > 1).expand()).subs(2*sin(1/2*theta)*cos(1/2*theta)==sin(theta),subs_options::algebraic) << endl;
> >
> > cout << "out: " << ((2*sin(1/2*theta)*cos(1/2*theta) +
> > 1).expand()).subs(sin(wild())*cos(wild())==sin(2*wild())/2) << endl;
> >
> > cout << "out: " << ((2*sin(1/2*theta)*cos(1/2*theta) +
> > 1).expand()).subs(sin(wild())*cos(wild())==sin(2*wild())/2,subs_options::algebraic) << endl;
> >
> >
> > out: 1
> > out: 1
> > out: 1
> > out: 1
> > out: 1
>
> ... and (obviously) there are no matches.
>
>
> Best regards,
> Alexei
>
> --
> All science is either physics or stamp collecting.
>
> _______________________________________________
> GiNaC-list mailing list
> GiNaC-list at ginac.de
> https://www.cebix.net/mailman/listinfo/ginac-list
More information about the GiNaC-list
mailing list