[GiNaC-list] How to express and simplify symbolic expressions in Ginac?
Anubhavnidhi Abhashkumar .
archie.nidhi at bytedance.com
Thu Apr 20 02:51:46 CEST 2023
Hi,
I am pretty new to GiNac library in c++ and am struggling with one
particular topic. I have been using ginac-1.8.6
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 <https://www.ginac.de/Download.html>. I also checked the manual
here <https://www.ginac.de/tutorial.pdf> but did not find an answer.
Thanks,
Archie
http://anubhavnidhi.github.io/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ginac.de/pipermail/ginac-list/attachments/20230419/475058d6/attachment.htm>
More information about the GiNaC-list
mailing list