Roots of unity

Hans Peter Würmli wurmli at
Sun Jan 20 17:12:43 CET 2002

On Sun, 20 Jan 2002 15:38:14 +0100 (CET)
"Richard B. Kreckel" <kreckel at> wrote:
To: ginac-list at
Subject: Re: Roots of unity

> [...]
> > > which is correct, if one simplifies 1/2+(-27/2+3/2*sqrt(93))^(-1)-1/18*sqrt(93) to 1
> > 
> > This is already way cool, isn't it?  But, to "simplify" is not
> > well-defined.  Such computations should not be done automatically at the
> > level of the anonymous avaluator (i.e. classwhatever::eval()).
> [...]
> Oops, I just realized that this particular case above is even more trivial
> and what I wrote doesn't apply to it yet.  Simply calling normal() will
> get the job done, since there is only one sqrt() in there.

I had tried with normal(), but now I realise that it makes a difference whether I use sqrt(2) or pow(2, numeric(1,2)).

If I take the same expression, but the numeric symbol replaced by, say, x, the same simplification does not take place.

I of course fully agree with you that "simplification" is not well defined terminology. On the other hand, you could still try to represent, say,

1/x^(1/2) as x^(1/2)/x

i.e. having all radicals of symbols in the numerator. Provided a didn't make a mistake, the above "simplification" can be accomplished generally. Take N(x^(1/n)) and D(x^(1/n)) two polynomials, regarding x^(1/n) as a symbol (where n is the lcm of the denominators of all exponents). If I can accomplish a full partial fraction representation of N/D, then I can use

(x^(1/n) - a) * (x^((n-1)/n)/a^(n-1) + x^((n-2)/n)/a^(n-2) + ... + 1) = x/a^(n-1) -a

If I look at the algorithms for symbolic integration, I have at least the hope that one could do a lot without having to find all roots of the denominator.

By the way: thank you for the references. If I have time (which is doubtful) I will consult them. I tried the little program for the roots of a third order polynomial rather to get used to GiNaC and to learn how one would, if one wanted, extend GiNaC to have algebraic structures and operations on them.

Best regards

Hans Peter

More information about the GiNaC-list mailing list