#2633 ev(integrate,numer) gives strange result

None
closed
nobody
5
2013-09-13
2013-09-12
No

The following term gives a strange result instead of 0. Without "numer", all is OK
Numerical inaccuracies are a nuisance, but this "false" kills further numerical computations.

ev(integrate(sin(2*%pi*x),x,0,1),numer);
> 0.1591549430919 (1 - cos(7.8398838568245917E-8 (25510582 %pi false - 80143857)))

Info:
- tested with Maxima 5.30.0 using Windows 7
- tested with Maxima 5.25.0 using Linux Fedora Core 16
- always reproducible
- ev(integrate(sin(x),x,0,2*%pi),numer); computes 0 as expected.

Discussion

  • Robert Dodier
    Robert Dodier
    2013-09-13

    Confirmed in Maxima 5.31.0 and 5.27.0.

    The presence of 'false' is certainly a bug. Bear in mind, however, that Maxima prefers exact numbers (integers and rationals) to inexact (floats and bigfloats). Probably it is better to compute a result using exact numbers and then convert the result to inexact. For example something like

    foo : integrate (whatever, x, a, b);
    float (foo);
    
     
  • Robert Dodier
    Robert Dodier
    2013-09-13

    • status: open --> closed
     
  • Robert Dodier
    Robert Dodier
    2013-09-13

    Presence of 'false' in result is caused by failure of PRETTY-GOOD-FLOOR-OR-CEILING to compute floor of 1.0. Avoid the problem by calling $FLOOR instead. Fixed by commit 807d4780. Therefore closing this report.

    Note that 807d4780 just removes 'false' from the output -- it is still a messy, although valid, numerical expression.

    foo : ev(integrate(sin(2*%pi*x),x,0,1),numer)
     => .1591549430918953*(1-cos(7.839883856824592E-8*(25510582*%pi-80143857)))
    float (foo);
     => 0.0