Extracting monomials from a polynomial

Anish Muttreja muttreja at princeton.edu
Mon Apr 5 04:32:18 CEST 2004


I am using ginac in a symbolic regression program.  It generates 
different polynomials using genetic programming, mulitplies each 
monomial by a weight and then fits the resulting
expression using regression.
I need to extract each monomial from the polynomial.

Until now , I have been getting by only dealing with the case where the 
top level class is "add",  and the program worked well enough for me to 
publish a paper on the use of symbolic regression in software 
modelling.  Yes , I wanted to let the authors know, they have another 
citation :-).

But this restricts the program.

Is there a better way to do this ? Will ex::expand () convert the 
expression to a polynomial

I should mention that the ginac expression itself is generated from a 
genetic evolved tree, so that I can generate all the monomials while 
doing this conversion, but that will leave me with the task of 
collecting like terms, something I would rather have done for me :-).


Anish Muttreja			~	Graduate Student
Electrical Engineering	~	Princeton University
As an adolescent I aspired to lasting fame, I craved factual certainty,
and I thirsted for a meaningful vision of human life - so I became a
scientist. This is like becoming an archbishop so you can meet girls.
-Matt Cartmill, anthropology professor and author (1943- )

More information about the GiNaC-list mailing list