[GiNaC-devel] help
Qin An
qin.an at 163.com
Thu Dec 23 13:41:03 CET 2004
Hi,
Thank you for your answering :)
I have worked out this problem. Yes, that is the reason that the exponent 2 of the expression must
be defined to integer type. I am sorry that I provided it is double type, 2.0 . However, the error
message do not cast light on me clearly enough.
by the way, I found the compile result is different between the kdevelop and the console compile
command. For example,
// test.cpp
#include <iostream>
#include <ginac/ginac.h>
using namespace std;
using namespace GiNaC;
int main(int argc, char *argv[])
{
symbol x("x");
ex exp = sin(x);
cout << exp << endl;
return EXIT_SUCCESS;
};
that is ok when you typed the command: c++ test.cpp -o test -lcln -lginac , the result showed
->sin(x);
but on the kdevelop, the compiler will show you the error messages:
/usr/local/include/ginac/container.h: In member function
`GiNaC::container_storage<C>::STLT GiNaC::container<<anonymous template
template parameter> >::evalchildren(int) const [with C = std::vector]':
/usr/local/include/ginac/container.h:557: instantiated from `GiNaC::ex GiNaC::container<<anonymous
template template parameter> >::eval(int) const [with C = std::vector]'
/usr/local/include/ginac/container.h:130: instantiated from here
/usr/local/include/ginac/container.h:708: exception handling disabled, use
-fexceptions to enable
That is same for asin,cos,acos, and so on.
I think the error may be parameter type of the sin founction, because you definded the parameter of
sin() is numeric type(that is smoothful when given the numeric type to x ). If I definded the x as
numeric type, I have not given the ginac symbolic computing performance for trigonometric
functions... That is so pity. I hope the symbolic computing performance will include the trigonometric
functions.
Could you give me some advice?
Thanks again.
(My computer is PIII 550,RedHat linux9, ginac-1.3.0, gcc-3.0, and the developing tool is kdevelop )
-Qin An
======= 2004-12-22 05:48:17 您在来信中写道:=======
>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/>
>
>_______________________________________________
>GiNaC-devel mailing list
>GiNaC-devel at ginac.de
>http://thep.physik.uni-mainz.de/mailman/listinfo/ginac-devel
>
= = = = = = = = = = = = = = = = = = = =
致
礼!
Qin An
qin.an at 163.com
2004-12-22
More information about the GiNaC-devel
mailing list