Roots of unity

Bob McElrath mcelrath at
Sun Jan 20 18:25:01 CET 2002

Richard B. Kreckel [kreckel at] wrote:
> The trouble starts already with trivial expressions: If a>0 and b>0, then
> (a+b)>0.  But (a-b) would have to return false, as would (b-a).  This
> makes it already difficult for sums.  Ternary logic would help a bit,
> here.   :-)

You wouldn't need it to be accurate 100% of the time.  Like some other
functions in the library, is_negative should be true if "it can be determined
that..." and false should mean either false or it cannot be determined.

In using this for simplifications and rearrangements, it only means that a
particular simplification wouldn't be applied.

I wonder if "cheating" and using evalf would get you into trouble?  i.e.
    evalf(a-b) < 0

-- Bob

Bob McElrath (rsmcelrath at 
Univ. of Wisconsin at Madison, Department of Physics
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
Url :

More information about the GiNaC-list mailing list