PPS And yes, using the line (i==0? ex(realsymbol("r")) : ex(symbol("s"))).dbgprinttree(); in the code produces the expected output. -- Vladimir V. Kisil http://www.maths.leeds.ac.uk/~kisilv/ Book: Geometry of Mobius Transformations http://goo.gl/EaG2Vu Software: Geometry of cycles http://moebinv.sourceforge.net/ Jupyter (Colab): https://github.com/vvkisil/MoebInv-notebooks Jupyter (CodeOcean): https://codeocean.com/capsule/7952650/tree
On Fri, 08 Nov 2019 20:57:52 +0000, "Vladimir V. Kisil" <kisilv@maths.leeds.ac.uk> said:
Dear All,
Consider the code:
#include <iostream> #include <ginac/ginac.h> using namespace std; using namespace GiNaC; int main() { for (int i=0; i < 2; ++i) (i==0? realsymbol("r") : symbol("s")).dbgprinttree();
return 0; }
My expectation would be that it first creates a realsymbol r and then a symbol s. However, the actual output of the programme is:
r (symbol) @0x7fff6e472700, serial=1, hash=0x1689b718, flags=0x6, domain=0 s (symbol) @0x7fff6e472700, serial=2, hash=0x1689b718, flags=0x6, domain=0
That is, in both cases the domain is 0 (complex) and r is not recognised as a real symbol.
Shall this be corrected or did I misunderstand the concept of (A? B : C) construct?
Best wishes, Vladimir
PS Another (less important and more disputable) question: do we want the debug output for realsymbol/possymbol look like
r (realsymbol) @0x7fff6e472700, serial=1, hash=0x1689b718, flags=0x6, domain=1 p (possymbol) @0x7fff6e472700, serial=1, hash=0x1689b718, flags=0x6, domain=2
to make the class more visible?