[GiNaC-list] Extension to Boolean Algebra?

Jens Vollinga jensv at nikhef.nl
Thu Mar 25 11:01:18 CET 2010


Hi,

Am 23.03.2010 12:17, schrieb Goran Frehse:
> Is there an extension of GiNAC to a boolean algebra? The "relational"

no.

> class seems to be already a step in this direction, as mathematically it
> could be evaluated to true or false. We would like to apply GiNaC in a
> context that involves boolean as well as real-valued expressions.
> It would be great if boolean expression could be represented,
> manipulated (expansion to CNF, DNF), and, if possible, parsed from a
> string.
> If this has not yet been done but is possible in principle, could we add
> this extension ourselves?

It is possible, and yes you can add that extension. But is it quite some 
work, I think.

You would have to implement your own GiNaC class (as part of the 
hierarchy) for representing a boolean such that the standard operations 
like +,*,etc. do what you want to have. Or, alternatively you could 
implement the boolean operations in the way the add, mul, etc. classes 
are done, which also boils down to implementing your own new class(es).

> Thanks in advance for any pointers on the subject.

So, I would advise you to look in section 6.5 of the GiNaC tutorial, 
where the implementation of new classes is explained.

Regards,
Jens


More information about the GiNaC-list mailing list