Ticket #11164: trac_11164_verify_integration_sinx_x.patch

File trac_11164_verify_integration_sinx_x.patch, 1.1 KB (added by D.S. McNeil, 11 years ago)

add doctest to confirm fix

  • sage/symbolic/integration/integral.py

    # HG changeset patch
    # User D. S. McNeil <dsm054@gmail.com>
    # Date 1323928434 18000
    # Node ID 72e93b129c17b56e336863c72dd77a57de536be4
    # Parent  9e29a3d84c48c399daaf3920bcb8b17273a0e876
    Trac #11164: verify integration of sin(x)/x
    
    diff --git a/sage/symbolic/integration/integral.py b/sage/symbolic/integration/integral.py
    a b  
    567567        2*pi
    568568        sage: a.simplify_full().simplify_trig()
    569569        1
     570
     571    Test that #11164 is fixed::
     572
     573        sage: eq = sin(x)/x
     574        sage: integrate(eq, x, -1e-6, 1e-6)
     575        I*Ei(-1/1000000*I) - I*Ei(1/1000000*I)
     576        sage: integrate(eq, x, -1e-6, 1e-6).n()
     577        3.14159465358979
     578        sage: integrate(eq, x, -1e-6, 1e6)
     579        1/2*I*Ei(-1000000*I) + 1/2*I*Ei(-1/1000000*I) - 1/2*I*Ei(1/1000000*I) -
     580        1/2*I*Ei(1000000*I)
     581        sage: integrate(eq, x, -1e-6, 1e6).n()
     582        4.71238904363291 + 7.92821250443249e-17*I
     583       
    570584    """
    571585    if isinstance(v, (list, tuple)) and a is None and b is None:
    572586        if len(v)==1: # bare variable in a tuple