Hello, GiNaC has the method dbgprinttree() which produces a tree structure for an expression. However, it may contain much more information than you are needing. I see several resolutions: * Parse and filter the output of dbgprinttree() for your needs. * Create your own printing context to produce a needed tree (dbgprinttree can be used as a model). * Use expression map (see the GiNaC tutorial) to convert an expression to a tree representation through your function. Best wishes, Vladimir -- Vladimir V. Kisil http://www.maths.leeds.ac.uk/~kisilv/ Book: Geometry of Mobius Maps https://doi.org/10.1142/p835 Soft: Geometry of cycles http://moebinv.sourceforge.net/ Jupyter notebooks: https://github.com/vvkisil/MoebInv-notebooks
On Wed, 21 Jul 2021 17:45:32 +0100, Aimad Chabounia <aimadchabounia@gmail.com> said:
AC> Hello, AC> I am currently doing an internship and we used GiNaC in our AC> project to simplify expressions. my question is how I can AC> generate a balanced expression tree from a ginac expression ?? AC> (now I create expressions in form of a binary expression tree) AC> Thanks and regards, Aimad