Menu

#4807 jacobi_p falls outside interval

None
closed
nobody
None
5
2026-07-21
2026-07-02
Dan Gildea
No
(%i32) n:9,a:0,b:3,x:-5/6;
(%o32)                                 9
(%i33)  orthopoly_returns_intervals : true;
(%o33)                               true
(%i34) exact : float(jacobi_p(n,a,b,x));
(%o34)                        0.5660762409911204
(%i35) approx : jacobi_p(n,float(a),float(b),float(x));
(%o35)       interval(0.5660762409910873, 3.1780473026681246e-14)
(%i36) abs(exact - part(approx, 1)) <= part(approx, 2);
(%o36)         3.3084646133829665e-14 <= 3.1780473026681246e-14

Discussion

  • Dan Gildea

    Dan Gildea - 2026-07-06

    This is a failing test case from rtest_orthopoly.mac. The test generates random inputs, and the values above cause a failure.

    jacobi_p calls hypergeo21, which gives an error interval. The test checks that the exact rational result falls within this error interval. I think that the problem is that there is already some imprecision in the input to hypergeo21. In this case, hypergeo21 is called with 11/12 in the exact version, but the floating point version of (1+5/6)/2 = 11/12 generates 0.9166666666666667d0, where as float(11/12) gives 0.9166666666666666d0.

    (%i3) (n:9,a:0,b:3,x:-5/6);
    
    (%o3) -(5/6)
    (%i4) jacobi_p(n,a,b,x);
    
      0: (MAXIMA::$HYPERGEO21 -9 13 1 ((MAXIMA::RAT MAXIMA::SIMP) 11 12) 9)
      0: $HYPERGEO21 returned ((RAT SIMP) 1460414533 2579890176)
    (%o4) 1460414533/2579890176
    (%i5) jacobi_p(n,float(a),float(b),float(x));
    
      0: (MAXIMA::$HYPERGEO21 -9 13.0d0 1.0d0 0.9166666666666667d0 9)
      0: $HYPERGEO21 returned 0.5660762409910873 2.951797787149161e-14
    (%o5) 0.5660762409910873
    
    (%i6) 11.0/12;
    
    (%o6) 0.9166666666666666
    
    (%i7) hypergeo21( -9, 13.0d0, 1.0d0, 0.9166666666666666d0, 9);
    
      0: (MAXIMA::$HYPERGEO21 -9 13.0d0 1.0d0 0.9166666666666666d0 9)
      0: $HYPERGEO21 returned 0.5660762409911406 2.9517977871491726e-14
    (%o7) 0.5660762409911406
    (%i8) 
    
     
  • Dan Gildea

    Dan Gildea - 2026-07-21
    • status: open --> closed
     
  • Dan Gildea

    Dan Gildea - 2026-07-21

    increased tolerance to account for rounding in conversion of initial rational to float
    [3af1fb3b4b9270359aa8a77ebe2e86a5fbbc6d1d]

     

    Related

    Commit: [3af1fb]


Log in to post a comment.