From: Richard Kreckel Date: Thu, 22 Jun 2000 00:08:50 +0000 (+0000) Subject: - exam_mansamples.cpp, exam_paranoia.cpp: fixes and extensions. X-Git-Tag: release_0-6-2~2 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=ed283907934f3ee30ae5c20451b5ac67f69571e9 - exam_mansamples.cpp, exam_paranoia.cpp: fixes and extensions. - ginaccint.bin.cpp: extended "silent" behaviour. --- diff --git a/cint/exam_mansamples.cpp b/cint/exam_mansamples.cpp index d26ad354..6703571b 100755 --- a/cint/exam_mansamples.cpp +++ b/cint/exam_mansamples.cpp @@ -5,11 +5,26 @@ symbol x("x"), y("y"), z("z"); ex a = pow(x,2)-x-2; ex b = pow(x+1,2); ex s = a/b; - if (!(s.diff(x)-2*pow(1+x,-3)*(-2-x+pow(x,2))-(-1+2*x)*pow(1+x,-2)).is_zero()) { + if (!(s.diff(x)+2/pow(1+x,3)*(-2-x+pow(x,2))-(-1+2*x)/pow(1+x,2)).is_zero()) { ++result; } if (!(s.normal()-(-2+x)/(1+x)).is_zero()) { ++result; } } +//GiNaC-cint.function +ex EulerNumber(unsigned n) +{ + symbol xi; + const ex generator = pow(cosh(xi),-1); + return generator.diff(xi,n).subs(xi==0); +} +if (EulerNumber(42) != ex(numeric("-10364622733519612119397957304745185976310201"))) { + ++result; +} +ex f = expand((x*y*z-1)*(x*y*z+3)); +ex g = expand((x*y*z-1)*(x*y*z-3)); +if (gcd(f, g) != x*y*z-1) { + ++result; +} exit(result); diff --git a/cint/exam_paranoia.cpp b/cint/exam_paranoia.cpp index 4fc7b981..d227545d 100755 --- a/cint/exam_paranoia.cpp +++ b/cint/exam_paranoia.cpp @@ -16,7 +16,7 @@ int result = 0; { symbol x; ex a = x; - if (bool(a != a)) { + if (a != a) { ++result; } } diff --git a/cint/ginaccint.bin.cpp b/cint/ginaccint.bin.cpp index db27e2b8..de396e60 100644 --- a/cint/ginaccint.bin.cpp +++ b/cint/ginaccint.bin.cpp @@ -3,8 +3,8 @@ #include "G__ci.h" /* G__atpause is defined in G__ci.h */ -#if (!defined(G__CINTVERSION)) || (G__CINTVERSION < 501438) -#error You need at least cint 5.14.38 to compile GiNaC-cint. Download it via http from root.cern.ch/root/Cint.html or via ftp from ftpthep.physik.uni-mainz.de/pub/cint +#if (!defined(G__CINTVERSION)) || (G__CINTVERSION < 501439) +#error You need at least cint 5.14.39 to compile GiNaC-cint. Download it via http from root.cern.ch/root/Cint.html or via ftp from ftpthep.physik.uni-mainz.de/pub/cint #endif // (!defined(G__CINTVERSION)) || (G__CINTVERSION < 501438) #include @@ -86,7 +86,8 @@ G__value exec_tempfile(string const & command) char * process_permanentfile(string const & command) { char *tmpfilename = tempnam(NULL,"ginac"); - cout << "creating file " << tmpfilename << endl; + if (!silent) + cout << "creating file " << tmpfilename << endl; ofstream fout; fout.open(tmpfilename); fout << command << endl; @@ -170,7 +171,7 @@ void greeting(void) << " (__) * | Germany. Cint C/C++ interpreter: (C) 1995-2000 Masaharu\n" << " ._) i N a C | Goto and Agilent Technologies, Japan. This is free software\n" << "<-------------' with ABSOLUTELY NO WARRANTY. For details, type `.warranty'\n" - << "Type .help for help.\n\n"; + << "Type `.help' for help.\n\n"; return; } @@ -313,7 +314,8 @@ string preprocess(char const * const line, bool & comment, bool & single_quote, void cleanup(void) { for (cplist::iterator it=filenames.begin(); it!=filenames.end(); ++it) { - cout << "removing file " << *it << endl; + if (!silent) + cout << "removing file " << *it << endl; remove(*it); free(*it); } @@ -470,7 +472,8 @@ bool readlines(istream * is, (is_command(command,preprocessed,"q"))) { quit = true; } else if (is_command(command,preprocessed,"function")) { - cout << "next expression can be a function definition" << endl; + if (!silent) + cout << "next expression can be a function definition" << endl; next_command_is_function = true; } else if (is_command(command,preprocessed,"cint")) { cout << endl << "switching to cint interactive mode" << endl;