# [GiNaC-list] Simplify clifford expresion: Works?

Javier Ros Ganuza jros at unavarra.es
Mon May 28 09:44:44 CEST 2007

```Dear Vladimir,

On Fri, 2007-05-25 at 15:43 +0100, Vladimir Kisil wrote:

> 	It is not easy to make our computers as intelligent as we may
>   wish. Try to modify your substitution rules to be more flexible: use
>   wildcards, use the rule sin(\$1)*cos(\$1)==sin(2*\$1)/2,
>   etc.
>

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

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;

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))

For example: what does mean: -e~(sin(theta)) ?

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;

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;

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

Is it something wroken in CVS version?

I've been playing with subs with previous versions (a different
project), and I have always got good results?

Thanks

Javier

>  Good luck,