Opened 4 months ago
Last modified 3 days 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.16 |
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 (4)
comment:1 Changed 3 months ago by gkronber
- Owner set to gkronber
- Status changed from new to accepted
comment:2 Changed 3 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 3 months ago by gkronber
comment:4 Changed 3 days ago by gkronber
- Version set to trunk
r16357: added comments for infix parser tests
Note: See
TracTickets for help on using
tickets.
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.