Hi there. I am reviving some 10-years old software that is based on GiNaC. When I started the work I was pessimistic, given so much time has passed. But now the thing compiles again. The problem is that I cannot parse the test-suite that was used for validation. I get: on line 392: parse error: GiNaC: parse error at line 0, column 0: expected ')' or ',' in argument list, got: "!" [GiNaC::ex GiNaC::parser::parse_identifier_expr()(parser/parser.cpp:88)] I guess something has changed in the parser, or maybe my reviving effort introduced a bug. Line 392 is the last one in this block: y (n+3)! factorial(3+n) factorial(3+n) factorial(n)*(3+n)*(1+n)*(2+n) factorial(3+n) factorial(3+n) This is the first block that contains an "!". This and all the subsequent blocks of tests that contain an "!" symbol fail in the same way. None of the blocks before fails. Any hint? Thanks, Roberto -- Prof. Roberto Bagnara Applied Formal Methods Laboratory Department of Mathematical, Physical and Computer Sciences University of Parma, Italy http://www.cs.unipr.it/~bagnara/ mailto:bagnara@cs.unipr.it
Dear Roberto! It seems that Ginsh and parser in GiNaC are implemented differently. Ginsh understands postfix factorial notation like "3!" but GiNaC parser is not. GiNaC parser is still happy with "factorial(3)". Best wishes, Vladimir -- Vladimir V. Kisil http://www.maths.leeds.ac.uk/~kisilv/ Book: Geometry of Mobius Maps https://doi.org/10.1142/p835 Soft: Geometry of cycles http://moebinv.sourceforge.net/ Jupyter notebooks: https://github.com/vvkisil/MoebInv-notebooks
On Thu, 13 May 2021 22:47:59 +0200, Roberto Bagnara <bagnara@cs.unipr.it> said:
RB> Hi there. RB> I am reviving some 10-years old software that is based on GiNaC. RB> When I started the work I was pessimistic, given so much time RB> has passed. But now the thing compiles again. The problem is RB> that I cannot parse the test-suite that was used for validation. RB> I get: RB> on line 392: parse error: GiNaC: parse error at line 0, column RB> 0: expected ')' or ',' in argument list, got: "!" [GiNaC::ex RB> GiNaC::parser::parse_identifier_expr()(parser/parser.cpp:88)] RB> I guess something has changed in the parser, or maybe my RB> reviving effort introduced a bug. Line 392 is the last one in RB> this block: RB> y (n+3)! factorial(3+n) factorial(3+n) RB> factorial(n)*(3+n)*(1+n)*(2+n) factorial(3+n) factorial(3+n) RB> This is the first block that contains an "!". This and all the RB> subsequent blocks of tests that contain an "!" symbol fail in RB> the same way. None of the blocks before fails. Any hint? RB> Thanks, RB> Roberto RB> -- Prof. Roberto Bagnara Applied Formal Methods Laboratory RB> Department of Mathematical, Physical and Computer Sciences RB> University of Parma, Italy http://www.cs.unipr.it/~bagnara/ RB> mailto:bagnara@cs.unipr.it RB> _______________________________________________ GiNaC-list RB> mailing list GiNaC-list@ginac.de RB> https://www.ginac.de/mailman/listinfo/ginac-list
On 5/14/21 9:52 AM, Vladimir V. Kisil wrote:
Dear Roberto!
It seems that Ginsh and parser in GiNaC are implemented differently. Ginsh understands postfix factorial notation like "3!" but GiNaC parser is not. GiNaC parser is still happy with "factorial(3)".
Best wishes, Vladimir
Thanks Vladimir! But please help me understand: I did not change anything in the part of the code invoking the GiNaC parser, and I did not change the tests. So the situation you are describing, i.e., GiNaC parser not understanding postfix factorial notation, is something that changed from, say, 10 years ago. In other words, do you agree that, say, 10 years ago, the GiNaC parser was accepting that notation? Sorry if I am off-track. Thanks a lot, Roberto -- Prof. Roberto Bagnara Applied Formal Methods Laboratory Department of Mathematical, Physical and Computer Sciences University of Parma, Italy http://www.cs.unipr.it/~bagnara/ mailto:bagnara@cs.unipr.it
On Fri, 14 May 2021 15:08:09 +0200, Roberto Bagnara <bagnara@cs.unipr.it> said:
RB> On 5/14/21 9:52 AM, Vladimir V. Kisil wrote: >> Dear Roberto! It seems that Ginsh and parser in GiNaC are >> implemented differently. Ginsh understands postfix factorial >> notation like "3!" but GiNaC parser is not. GiNaC parser is >> still happy with "factorial(3)". Best wishes, Vladimir >> RB> Thanks Vladimir! But please help me understand: I did not RB> change anything in the part of the code invoking the GiNaC RB> parser, and I did not change the tests. So the situation you RB> are describing, i.e., GiNaC parser not understanding postfix RB> factorial notation, is something that changed from, say, 10 RB> years ago. In other words, do you agree that, say, 10 years RB> ago, the GiNaC parser was accepting that notation? It seems that before 2008-08-21 GiNaC and Ginsh had used the same parser, which Ginsh is using till now. After a patch they diverged in this respect. So it is quite well possible that your code was running with the old version of GiNaC but cannot do this now without some alteration. -- Vladimir V. Kisil http://www.maths.leeds.ac.uk/~kisilv/ Book: Geometry of Mobius Maps https://doi.org/10.1142/p835 Soft: Geometry of cycles http://moebinv.sourceforge.net/ Jupyter notebooks: https://github.com/vvkisil/MoebInv-notebooks
On 5/14/21 3:33 PM, Vladimir V. Kisil wrote:
On Fri, 14 May 2021 15:08:09 +0200, Roberto Bagnara <bagnara@cs.unipr.it> said:
RB> On 5/14/21 9:52 AM, Vladimir V. Kisil wrote: >> Dear Roberto! It seems that Ginsh and parser in GiNaC are >> implemented differently. Ginsh understands postfix factorial >> notation like "3!" but GiNaC parser is not. GiNaC parser is >> still happy with "factorial(3)". Best wishes, Vladimir >>
RB> Thanks Vladimir! But please help me understand: I did not RB> change anything in the part of the code invoking the GiNaC RB> parser, and I did not change the tests. So the situation you RB> are describing, i.e., GiNaC parser not understanding postfix RB> factorial notation, is something that changed from, say, 10 RB> years ago. In other words, do you agree that, say, 10 years RB> ago, the GiNaC parser was accepting that notation?
It seems that before 2008-08-21 GiNaC and Ginsh had used the same parser, which Ginsh is using till now. After a patch they diverged in this respect. So it is quite well possible that your code was running with the old version of GiNaC but cannot do this now without some alteration.
Dear Vladimir, This explains everything. Now I am investigating failures in the regression test-suite. One of the most promising examples for my diagnosis efforts is this: simplification for output of -1+1/12*sqrt(sqrt(3)*sqrt(12))*sqrt(12)+1/12*sqrt(-sqrt(3)*sqrt(12))*sqrt(12) was expected to be -1+(1/2+1/2*I)*sqrt(2) but resulted in -1+(1/2+1/2*I)*4^(1/4) From what you write I gather that back in 2008, or even before, we obtained sqrt(2) where we now obtain 4^(1/4). Thanks, Roberto -- Prof. Roberto Bagnara Applied Formal Methods Laboratory Department of Mathematical, Physical and Computer Sciences University of Parma, Italy http://www.cs.unipr.it/~bagnara/ mailto:bagnara@cs.unipr.it
Dear Roberto, On 14.05.21 22:36, Roberto Bagnara wrote:
simplification for output of -1+1/12*sqrt(sqrt(3)*sqrt(12))*sqrt(12)+1/12*sqrt(-sqrt(3)*sqrt(12))*sqrt(12)
was expected to be -1+(1/2+1/2*I)*sqrt(2) but resulted in -1+(1/2+1/2*I)*4^(1/4)
From what you write I gather that back in 2008, or even before, we obtained sqrt(2) where we now obtain 4^(1/4).
What exactly are you doing when you say "simplification"? And did GiNaC really return that result in 2008? I tried historic versions of ginsh and I see that expand() really rewrites this term, but only after GiNaC 1.6.3. Versions 1.3.8 (released 2007) until 1.6.2 (released 2011) return it unmodified. All my best, -richy. -- Richard B. Kreckel <https://in.terlu.de/~kreckel/>
participants (3)
-
Richard B. Kreckel
-
Roberto Bagnara
-
Vladimir V. Kisil