[GiNaC-devel] help

Richard B. Kreckel kreckel at thep.physik.uni-mainz.de
Tue Dec 21 22:54:03 CET 2004


Hi,

I cannot reproduce your findings.

On Mon, 20 Dec 2004, Qin An wrote:
> some standard functions do not run smothfully everytime
>
>
> the function -- expand:
> when I used it as follow:
> #include <iostream>
> #include <ginac/ginac.h>
> using namespace std;
> using namespace GiNaC;
>
> main()
> {
>   ex e = expand(power(x+1,2));
>   cout << e << endl;
> }
> the result given by ginac is: (x+1)^2

You have not declared x.  When I do so, the output is 1+x^2+2*x, as it
should.

> but when I give him the parameters as follows:
> main()
> {
>   ex e = expand((x+1)*(x+1));
>   cout << e << endl;
> }
> the result is right: 1.0 + x^2.0 + 2.0*x

I get the same as above.  Again, as it should.  But with integers, rather
than with floating point values.

> the difference above is conspicuous, when the above function  has been
> used in other C++ class files that have not the main function.
>
> could anyone give some advice?  thanks!

Please provide a self-contained example program, if necessary together
with instructions how to compile and invoke it.  Please provide the output
you obtain and the output you think would be correct.  Otherwise nobody
will be able to help you.

> by the way, my computer is PIII 550, REDHAT Linux 9,gcc is 3.0, and the
> developing tool is kdevelop.

Please include the version of GiNaC you are using.

Regards
    -richy.
-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>




More information about the GiNaC-devel mailing list