Opened 8 years ago

Closed 7 years ago

#14318 closed enhancement (fixed)

More doctests from the book "Calcul mathématique avec Sage" chapter "integration"

Reported by: lfousse Owned by: mvngu
Priority: minor Milestone: sage-6.1
Component: doctest coverage Keywords:
Cc: Merged in:
Authors: Laurent Fousse, Paul Zimmermann, Frédéric Chapoton Reviewers: Frédéric Chapoton, Paul Zimmermann
Report Upstream: N/A Work issues:
Branch: u/chapoton/14318 Commit: 91f4bcb0655ac10491abda179d0db0104412117d
Dependencies: Stopgaps:

Description (last modified by jdemeyer)

The attached file provides doctests for examples in the chapter on integration and differential equations. Tests pass with 5.11.

Apply only trac_14318_doctests_from_french_book.patch

Attachments (2)

integration_doctest.sage (6.5 KB) - added by lfousse 8 years ago.
trac_14318_doctests_from_french_book.patch (7.3 KB) - added by zimmerma 7 years ago.

Download all attachments as: .zip

Change History (24)

Changed 8 years ago by lfousse

comment:1 Changed 8 years ago by lfousse

  • Status changed from new to needs_review

comment:2 Changed 8 years ago by jdemeyer

What am I supposed to do with this file? Normally, additions to Sage are patches to the Sage library (in devel/sage). See http://sagemath.org/doc/developer/

comment:3 Changed 8 years ago by jdemeyer

  • Status changed from needs_review to needs_work

comment:4 Changed 7 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:5 Changed 7 years ago by zimmerma

  • Authors set to Laurent Fousse, Paul Zimmermann
  • Description modified (diff)
  • Status changed from needs_work to needs_review

I've made a proper patch. All tests pass with Sage 5.11. Ready for review.

Paul

comment:6 Changed 7 years ago by chapoton

  • Reviewers set to Frédéric Chapoton
  • Status changed from needs_review to positive_review

ok, looks good to me

comment:7 Changed 7 years ago by chapoton

  • Summary changed from More doctests from the book "Calcul mathématique avec Sage" to More doctests from the book "Calcul mathématique avec Sage" chapter "integration"

comment:8 Changed 7 years ago by jdemeyer

  • Description modified (diff)

comment:9 Changed 7 years ago by zimmerma

thank you Frédéric.

Paul

comment:10 Changed 7 years ago by jdemeyer

  • Status changed from positive_review to needs_work

Some of these examples yield slightly different results on 32-bit systems:

sage -t --long devel/sage/sage/tests/french_book/integration_doctest.py
**********************************************************************
File "devel/sage/sage/tests/french_book/integration_doctest.py", line 30, in sage.tests.french_book.integration_doctest
Failed example:
    N(integrate(exp(-x^2)*log(x), x, 17, 42))
Expected:
    2.5657285006962035e-127
Got:
    2.565728500696221e-127
**********************************************************************
File "devel/sage/sage/tests/french_book/integration_doctest.py", line 42, in sage.tests.french_book.integration_doctest
Failed example:
    numerical_integral(exp(-x^2)*log(x), 17, 42)
Expected:
    (2.5657285006962035e-127, 3.3540254049238093e-128)
Got:
    (2.565728500696221e-127, 3.3540254049023843e-128)
**********************************************************************
File "devel/sage/sage/tests/french_book/integration_doctest.py", line 49, in sage.tests.french_book.integration_doctest
Failed example:
    numerical_integral(exp(-x^100), 0, 1.1, algorithm='qng')
Expected:
    (0.994327538576531..., 0.016840666914688864)
Got:
    (0.9943275385765319, 0.016840666914705607)
**********************************************************************
File "devel/sage/sage/tests/french_book/integration_doctest.py", line 59, in sage.tests.french_book.integration_doctest
Failed example:
    N(integrate(exp(-x^2)*log(x), x, 17, 42), 200)
Expected:
    2.5657285006962035e-127
Got:
    2.565728500696221e-127
**********************************************************************
File "devel/sage/sage/tests/french_book/integration_doctest.py", line 80, in sage.tests.french_book.integration_doctest
Failed example:
    gp('intnum(x=17, 42, exp(-x^2)*log(x))')
Expected:
    2.5657285005610514829173563961304785900 E-127
Got:
    2.565728500561051482917356396 E-127
**********************************************************************
File "devel/sage/sage/tests/french_book/integration_doctest.py", line 85, in sage.tests.french_book.integration_doctest
Failed example:
    gp('intnum(x=0, 1, sin(sin(x)))')
Expected:
    0.43060610312069060491237735524846578643
Got:
    0.4306061031206906049123773553
**********************************************************************
File "devel/sage/sage/tests/french_book/integration_doctest.py", line 94, in sage.tests.french_book.integration_doctest
Failed example:
    gp('intnum(x=0, 1, x^(-1/2))')
Expected:
    1.999999999999999999999999999998...
Got:
    1.999999999999999999990291881
**********************************************************************
File "devel/sage/sage/tests/french_book/integration_doctest.py", line 99, in sage.tests.french_book.integration_doctest
Failed example:
    gp('intnum(x=[0, -1/2], 1, x^(-1/2))')
Expected:
    2.00000000000000000000000000000...
Got:
    2.000000000000000000000000000
**********************************************************************
File "devel/sage/sage/tests/french_book/integration_doctest.py", line 104, in sage.tests.french_book.integration_doctest
Failed example:
    gp('intnum(x=[0, -1/42], 1, x^(-1/2))')
Expected:
    1.9999999999999999999999999999996...
Got:
    1.999999999999999999996899473
**********************************************************************

comment:11 Changed 7 years ago by jdemeyer

On Linux ia64:

sage -t --long devel/sage/sage/tests/french_book/integration_doctest.py
**********************************************************************
File "devel/sage/sage/tests/french_book/integration_doctest.py", line 30, in sage.tests.french_book.integration_doctest
Failed example:
    N(integrate(exp(-x^2)*log(x), x, 17, 42))
Expected:
    2.5657285006962035e-127
Got:
    2.565728500696221e-127
**********************************************************************
File "devel/sage/sage/tests/french_book/integration_doctest.py", line 42, in sage.tests.french_book.integration_doctest
Failed example:
    numerical_integral(exp(-x^2)*log(x), 17, 42)
Expected:
    (2.5657285006962035e-127, 3.3540254049238093e-128)
Got:
    (2.565728500696221e-127, 3.3540254049023813e-128)
**********************************************************************
File "devel/sage/sage/tests/french_book/integration_doctest.py", line 59, in sage.tests.french_book.integration_doctest
Failed example:
    N(integrate(exp(-x^2)*log(x), x, 17, 42), 200)
Expected:
    2.5657285006962035e-127
Got:
    2.565728500696221e-127
**********************************************************************

comment:12 follow-up: Changed 7 years ago by zimmerma

  • Status changed from needs_work to needs_review

the new attachment should fix the numerical noise issues on both 32-bit systems and ia64. I'm not sure the notation 1.2345... works with the scientific notation, thus I've used # rel tol in some places.

Paul

comment:13 in reply to: ↑ 12 Changed 7 years ago by jdemeyer

Replying to zimmerma:

the new attachment should fix the numerical noise issues on both 32-bit systems and ia64. I'm not sure the notation 1.2345... works with the scientific notation, thus I've used # rel tol in some places.

The ... notation in doctest results works purely with strings, it doesn't interpret the numbers. Tolerances like # rel tol do interpret the numbers, so that's probably the better choice indeed.

comment:14 Changed 7 years ago by chapoton

  • Status changed from needs_review to needs_work

Hello,

I am not happy with the indentation: it should be 4 spaces instead of 2 !

Otherwise, this should be good to go.

Changed 7 years ago by zimmerma

comment:15 Changed 7 years ago by zimmerma

  • Status changed from needs_work to needs_review

I am not happy with the indentation: it should be 4 spaces instead of 2 !

fixed in the new attachment.

Paul

comment:16 Changed 7 years ago by jdemeyer

  • Status changed from needs_review to needs_work

There still remains

sage -t --long devel/sage/sage/tests/french_book/integration_doctest.py
**********************************************************************
File "devel/sage/sage/tests/french_book/integration_doctest.py", line 94, in sage.tests.french_book.integration_doctest
Failed example:
    gp('intnum(x=0, 1, x^(-1/2))')
Expected:
    1.999999999999999999999...
Got:
    1.999999999999999999990291881
**********************************************************************
File "devel/sage/sage/tests/french_book/integration_doctest.py", line 104, in sage.tests.french_book.integration_doctest
Failed example:
    gp('intnum(x=[0, -1/42], 1, x^(-1/2))')
Expected:
    1.999999999999999999999...
Got:
    1.999999999999999999996899473
**********************************************************************

comment:17 Changed 7 years ago by chapoton

  • Branch set to u/chapoton/14318
  • Commit set to 91f4bcb0655ac10491abda179d0db0104412117d
  • Status changed from needs_work to needs_review

New commits:

91f4bcbtrac #14318 lower precision required
804f8f9#14318: More doctests from the book "Calcul mathématique avec Sage" chapter "integration"

comment:18 Changed 7 years ago by chapoton

Paul or Laurent, if you agree with my changes, you can set this to positive review.

comment:19 Changed 7 years ago by zimmerma

Paul or Laurent, if you agree with my changes, you can set this to positive review.

Frédéric, commit 91f4bcb is fine to me. I guess the other one (804f8f9) is just the original file?

Paul

comment:20 Changed 7 years ago by chapoton

Yes, the first commit is just the patch trac_14318_doctests_from_french_book.patch​ turned into a git commit

comment:21 Changed 7 years ago by zimmerma

  • Authors changed from Laurent Fousse, Paul Zimmermann to Laurent Fousse, Paul Zimmermann, Frédéric Chapoton
  • Reviewers changed from Frédéric Chapoton to Frédéric Chapoton, Paul Zimmermann
  • Status changed from needs_review to positive_review

thanks, then I give a positive review.

Paul

comment:22 Changed 7 years ago by vbraun

  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.