[PURRS-devel] [Fwd: Re: Type gen]

Tatiana Zolo zolo at cs.unipr.it
Fri Oct 17 09:22:15 CEST 2003

-------- Original Message --------
Subject: Re: Type gen
Date: Thu, 16 Oct 2003 18:01:00 +0200
From: "bernard.parisse" <parisse at mozart.ujf-grenoble.fr>
To: Tatiana Zolo <zolo at cs.unipr.it>
References: <3F8EC720.CC99C648 at cs.unipr.it>

Tatiana Zolo wrote:

>my problem is the following and it can be split in 3 parts:
>1) transform my object (expressions of various types) in a giac object
>2) factorize the giac object
>3) come back to my object.
>I know how to do the problem 2): I used  the type `gen' and the
>functions in the file
>About the problems 1) and 2) I did something in both the directions but
>I want ask you
>the best method to decompose a type gen.
>For example, if I have `g' of the type gen, where g = a + b + c + d,
>how can I consider the single summands? The same problem with a product
>of gen,
>a power of gen, ...
>How can I know if `g' is a sum of gen? Or a product of gen?
>I did not find these methods in the file gen.h.
>Is there documentation about these topics?

There is preliminary documentation in info format, if you installed giac
by make install, you should have it in /usr/local/info (in emacs Ctrl-U 
Ctrl-H I
followed by /usr/local/info/giac.info should open it). Alternatively
the HTML translated file is on my web site.
For your question, a gen g that is a sum or a product or any kind of 
function applied to arguments is such that g.type==_SYMB and
g._SYMBptr->sommet is the operator or function,
g._SYMBptr->feuille is the argument (if the function is unary)
or the vector of arguments (if the function has more than 1 arg).
You can check the function either by g._SYMBptr->sommet==
at_plus (for +) or at_prod (for *) or any other operator, or by
For exemple if g=a+b+c+d
if (g.is_symb_of_sommet(at_plus)){
  gen & arg=g._SYMBptr->feuille;
  if (arg.type==_VECT){
    vecteur & v= *arg._VECTptr;
    int s=v.size(); // number of args


More information about the PURRS-devel mailing list