invalid expression in content|unit|...()
Pearu Peterson
pearu at cens.ioc.ee
Thu Nov 22 14:21:30 CET 2001
Hi,
While unit-testing pyginac, I found the following inconsistency:
1) define
a = symbol("a")
b = symbol("b")
c = constant("c")
2) observe
content(2,a) -> 0 (ok)
content(2*a + 4*c,a) -> 2 (ok)
content(a*c,a) -> exception 'invalid expression in unit()' ?!
content(a*b,a) -> b (ok)
3) similar behaviour can be observed also for other functions like unit,..
The question is:
Is it possible to unify the behaviour of the relevant functions?
That is, to extend them to accept other objects in addition to symbol,
numeric, add, etc. Or, to raise an exception whenever there are alien
object in expressions. (Though, constants should not be alien when
comparing them with symbols.)
My argument to consider this inconsistency as a problem is that this
behaviour is confusing and could lead to difficult-to-find bugs.
Thanks,
Pearu
More information about the GiNaC-devel
mailing list