Hello, I am currently doing an internship and we used GiNaC in our project to simplify expressions. my question is how I can generate a balanced expression tree from a ginac expression ?? (now I create expressions in form of a binary expression tree) Thanks and regards, Aimad
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
Thank you so much. I really appreciate that. Best regards, On Thu, Jul 22, 2021, 11:27 AM Vladimir V. Kisil <V.Kisil@leeds.ac.uk> wrote:
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 _______________________________________________ GiNaC-list mailing list GiNaC-list@ginac.de https://www.ginac.de/mailman/listinfo/ginac-list
participants (2)
-
Aimad Chabounia
-
Vladimir V. Kisil