Menu

#3964 limit converts float exponents to rational

None
open
nobody
5
2022-05-05
2022-04-19
No

In 5.46, limit converts float values of the variable to rational if (and only if) they are in the exponent:

(%i1) limit(2^x,x,0.1);

rat: replaced 0.1 by 1/10 = 0.1

rat: replaced 0.1 by 1/10 = 0.1
                                      1/10
(%o1)                                2

however:

(%i2) limit(x^2,x,0.1);        
(%o2)                                0.01

This seems unexpected and inconsistent. Bisected it to https://sourceforge.net/p/maxima/code/ci/20b3068fb7e8f3528e9b6aa7abf47185248cb8e3

Discussion

  • Stavros Macrakis

    I agree that this is a change from 5.45, but frankly I can't get too excited about it, because many of Maxima's symbolic routines convert floats to rationals most of the time -- though not always.

    solve(x=0.5,x),keepfloat:true => [x=1/2]
    integrate(x,x,0.0,1.0) => 1/2
    integrate(x,x,0.0,1.0),keepfloat:true => 1/2  << KF doesn't work
    integrate(sin(x),x,0,1.0) => 406…/884…
    integrate(sin(x),x,0,1.0),keepfloat:true => 0.459…  << KF does work
    limit(x*2.0,x,1.0) => 2.0  <<< OK
    limit(x*2.0,x,0.0) => 0  <<< 0 treated as special?
    eigenvalues(matrix([1.2,2.3],[0.0,1.0])),keepfloat:true => rationals
    
     
  • Robert Dodier

    Robert Dodier - 2022-05-05
    • labels: --> limit, floating point
     
  • Robert Dodier

    Robert Dodier - 2022-05-05

    I don't think this is a bug. limit is an algebraic operation, so it makes sense to convert floats to rationals before proceeding. I agree the behavior is inconsistent, and that's a bug -- floats should be consistently converted to rationals.

     

Log in to post a comment.