Opened 18 months ago

Last modified 7 months ago

#2938 accepted defect

The parser for symbolic expressions in infix form parses negative numbers and fractions strangly

Reported by: gkronber Owned by: gkronber
Priority: medium Milestone: HeuristicLab 3.3.17
Component: Problems.DataAnalysis.Symbolic Version: trunk
Keywords: Cc:

Description (last modified by gkronber)

Some examples:

  • Input: -1.0*x + 2.0
  • Expected:
      (+ 
         (* -1.0 x) 
         2.0)
    
  • Output:
    (+ 
      (- (* 1.0 x))
      2.0)
    
  • Input: exp(-1.0*x - 2.0)
  • Output:
    (exp (* 
           -1.0 
           (+ 
             (* 1.0 x) 
             2.0)))
    
  • Expected:
    (exp (- 
           (* -1.0 x)
            2.0))
    
  • Input: 3/3+2/2+1/1
  • Output:
     ((3 * 1/3) + (2 * 1/2) + (1 * 1/1))
    

Change History (6)

comment:1 Changed 16 months ago by gkronber

  • Owner set to gkronber
  • Status changed from new to accepted

comment:2 Changed 16 months ago by gkronber

  • Description modified (diff)
  • Summary changed from The parser for symbolic expressions in infix form parses negative numbers strangly to The parser for symbolic expressions in infix form parses negative numbers and fractions strangly

comment:3 Changed 16 months ago by gkronber

The main problem is that by parsing "-x" as (-1)*x we effectively introduce an additional constant (see non-linear regression). The same issue occurs when parsing "x/y" as "x * 1/y".

Parsing "-3.14" as "(-1)*3.14" is especially strange.

comment:4 Changed 14 months ago by gkronber

  • Version set to trunk

r16357: added comments for infix parser tests

comment:5 Changed 7 months ago by gkronber

We can merge r16357 now or move this ticket to the next milestone.

comment:6 Changed 7 months ago by gkronber

  • Milestone changed from HeuristicLab 3.3.16 to HeuristicLab 3.3.17
Note: See TracTickets for help on using tickets.