# [GiNaC-list] Ordering and pattern matching

Chris Kelly giltirn at gmail.com
Tue Sep 1 19:33:31 CEST 2009

```Hi Vladimir,

On Tue, Sep 1, 2009 at 12:15 PM, Vladimir V. Kisil <kisilv at maths.leeds.ac.uk
> wrote:

>
> >>>>> On Tue, 25 Aug 2009 16:12:37 +0100, Chris Kelly <giltirn at gmail.com>
> said:
>
>    CK> grips with the clifford algebra classes. I am trying to perform
>    CK> the simple substitution:
>    CK> A_mu gamma_mu B_nu gamma_nu = A_mu A_nu delta_mu,nu (Euclidean
> space).
>
>        Why you are doing this replacement? I do not think it is
> mathematically
>  correct, it shall be:
>
> A_mu gamma_mu B_nu gamma_nu + B_nu gamma_nu A_mu gamma_mu  = A_mu A_nu
> delta_mu,nu
>
>  You can get that answer by canonicalize_clifford() method without any
>  substitution.
>
>
Indeed you are correct, it is only true when A=B. I over-generalised my
example without thinking it through. In my main problem I only ever need to
replace A_mu gamma_mu A_nu gamma_nu = A_mu A_nu delta_mu,nu. However my
example still retains some validity in the sense that this replacement will
not work either!

>    CK> Here is some example code:
>
>    CK>   ex metric = unit_matrix(4); idx i(symbol("i"),4) ,
>    CK>   j(symbol("j"),4); ex al_i = clifford_unit(i,metric); //Use
>    CK>   //  generalised clifford gamma  matrices for euclidean space
>    CK>   //Create generic 'slashed' symbols with euclidean metric
>
>        You may prefer to use delta tensor rather than unit matrices to
>  create this Clifford units---output of simplification will be more
>  transparent.
>
> Thank you, i'll give this a try.

I don't suppose you have an answer to my question about whether there is
some way to canonically order an expression by a set of rules rather than by
the hash value such that i can find a pattern that is guaranteed to match?

Best,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cebix.net/pipermail/ginac-list/attachments/20090901/c0bc6575/attachment.htm>
```