Changes between Initial Version and Version 2 of Ticket #28415

08/28/19 09:56:44 (3 years ago)

The user interface is maybe not very natural, but I couldn't figure out anything that was clearly better (right now the hints are just tuples of symbolic equations, I considered creating specific classes for this, but I am not sure it is a better solution).

Also, I am also not sure if the ManualIntegral? class should be imported by default (the name space is already bloated, but mostly, I am not sure if this is the kind of thing that you want to offer by default to students, or if it is preferable to offer it as some kind of 'optional' feature).

I would appreciate any comments obout these questions.

New commits:

6cd0e60First implementation
9824f80Complete docstrings and tests.


  • Ticket #28415

    • Property Authors changed from to Miguel Marco
    • Property Component changed from PLEASE CHANGE to symbolics
    • Property Branch changed from to u/mmarco/manualintegrate
    • Property Keywords integration education added
    • Property Commit changed from to 9824f80aee60f09d2e6faeaf30b3a7640c77107a
    • Property Type changed from PLEASE CHANGE to enhancement
  • Ticket #28415 – Description

    initial v2  
     1This branch implements a system to compute symbolic integrals step by step, trying to follow the rules that are taught to students to compute integrals by hand.
     3To compute the appropriate rules, it uses the sympy module `manualintegrate`.
     5It is exposed to the user through a `ManualIntegral` class, that can either be iterated to get hints on steps to follow:
     9sage: from sage.symbolic.integration.manual import ManualIntegral
     10sage: M = ManualIntegral(exp(x)*sin(x), x)
     11sage: M.hint()
     12(u == sin(x),
     13 dv == e^x,
     14 du == cos(x),
     15 v == integrate(e^x, x),
     16 integrate(e^x*sin(x), x) == v*sin(x) - integrate(v*cos(x), x))
     17sage: M.hint()
     18(integrate(e^x, x) == e^x,)
     19sage: M.hint()
     20(u == cos(x),
     21 dv == e^x,
     22 du == -sin(x),
     23 v == integrate(e^x, x),
     24 integrate(cos(x)*e^x, x) == v*cos(x) - integrate(-v*sin(x), x))
     25sage: M.hint()
     26(integrate(e^x, x) == e^x,)
     27sage: M.hint()
     28(integrate(e^x*sin(x), x) == -cos(x)*e^x + e^x*sin(x) - integrate(e^x*sin(x), x),
     29 2*integrate(e^x*sin(x), x) == -cos(x)*e^x + e^x*sin(x))
     33Also, all hints can be listed at once:
     37sage: M.all_hints()
     38[(u == sin(x),
     39  dv == e^x,
     40  du == cos(x),
     41  v == integrate(e^x, x),
     42  integrate(e^x*sin(x), x) == v*sin(x) - integrate(v*cos(x), x)),
     43 (integrate(e^x, x) == e^x,),
     44 (u == cos(x),
     45  dv == e^x,
     46  du == -sin(x),
     47  v == integrate(e^x, x),
     48  integrate(cos(x)*e^x, x) == v*cos(x) - integrate(-v*sin(x), x)),
     49 (integrate(e^x, x) == e^x,),
     50 (integrate(e^x*sin(x), x) == -cos(x)*e^x + e^x*sin(x) - integrate(e^x*sin(x), x),
     51  2*integrate(e^x*sin(x), x) == -cos(x)*e^x + e^x*sin(x))]