0

I am pretty new to GiNac library in c++ and am struggling with one particular topic. I want to represent and simplify symbolic expressions (expressions with union, intersection, and not operator) with GiNac. I have been trying the following example

#include <iostream>
#include <ginac/ginac.h>
using namespace std;
using namespace GiNaC;

int main()
{
    symbol x("x"), y("y"), z("z");
    ex boolean_expr = (!x || y) && (x || z);
    cout << "Boolean expression: " << boolean_expr << endl;

    ex simplified_expr = normal(boolean_expr);
    cout << "Simplified expression: " << simplified_expr << endl;

    return 0;
}

But I keep on getting errors related to ||, !, and && operators. For example,

> note: candidate: ‘operator!(bool)’ <built-in>
> note:   no known conversion for argument 1 from ‘GiNaC::symbol’ to `bool’                                                             
> error: no match for ‘operator!’ (operand type is `GiNaC::symbol’)                                                                     

I also tried replacing ||, !, and && to or, not, and, respectively but get similar errors

> error: no match for ‘operator!’ (operand type is ‘GiNaC::symbol’)                                                                     
          ex boolean_expr = not(x) or y and (x or not(z));

So my question is how can I represent and, or, not. I am using Ginac 1.8.6 from here. I also checked the manual here but did not find an answer.

brokendreams
  • 827
  • 2
  • 10
  • 29

0 Answers0