[GiNaC-list] About 'incomprehensible' output (Was: extending the symbol)

Alexei Sheplyakov varg at theor.jinr.ru
Tue Oct 7 14:37:10 CEST 2008


Hello,

> Can you please attach a copy of your replies to my email address? I disable
> email delivery whenever I subscribe to forums as most of the times I post
> infrequently.

Sure. Also you can set proper Reply-To: header so my email client software
will do this automatically.
 

> If vector and scalar products of vectors are not given their own identities
> but are implemented using the clifford algebra as in the post
> http://www.ginac.de/pipermail/ginac-list/2005-June/000671.html then the
> output no longer bears any resemblance to the original definition. For
> example the consider the following output
>    
> "-C.0*B.2*A.1-C.1*A.2*B.0+C.2*B.0*A.1+C.0*A.2*B.1+C.1*B.2*A.0-C.2*B.1*A.0"
> There is no resemblance to the original definition

In general, the canonical form of GiNaC expressions is unpredictable, i.e.
it changes from run to run (no matter what is the type of the expression).
The following script demonstrates this:

for i in `seq 1 100`; do 
	echo "a = x; b = y; x - y;" | ginsh
done |  sort -n | uniq
x
x-y
y
-y+x

Depending on luck, canonical form of the same expression (x-y) might be
either 'x-y' or '-y+x' (of course it's the same during one run).

This is kind of design decision: we trade deterministic output for speed.
(Still nothing prevents interested parties from writing a custom printing
method which outputs terms in a more or less predictable manner).

> which could be printed nicely "A . (B x C)"

> To emphasize my point, I dont really care how the triple product is
> represented inside. But when things go wrong (due to bugs) I would like to
> easily debug the code. For example, if I was expecting A . (C x B), the
> second output will immediately point out that to me.

This problem can be solved with a custom printing method. But the real
question is: do you really need/want to represent tensor expressions in
a component form?

> On the other hand if scalar and vector products of vectors are given their
> own identities, then there is no need for clifford algebra any more to
> evaluate them.

You can write a new class from scratch if modifying clifford (or indexed)
is not an option.

Best regards,
	Alexei

-- 
All science is either physics or stamp collecting.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
Url : http://www.cebix.net/pipermail/ginac-list/attachments/20081007/95fde903/attachment.sig 


More information about the GiNaC-list mailing list