Opened 3 years ago
Last modified 4 months ago
#28415 needs_review enhancement
Step by step integration for educational use — at Version 2
Reported by: | mmarco | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-9.7 |
Component: | symbolics | Keywords: | integration, education, sd110 |
Cc: | nthiery, kcrisman, slelievre | Merged in: | |
Authors: | Miguel Marco | Reviewers: | |
Report Upstream: | N/A | Work issues: | |
Branch: | u/mmarco/manualintegrate (Commits, GitHub, GitLab) | Commit: | 9824f80aee60f09d2e6faeaf30b3a7640c77107a |
Dependencies: | Stopgaps: |
Description (last modified by )
This 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.
To compute the appropriate rules, it uses the sympy module manualintegrate
.
It is exposed to the user through a ManualIntegral
class, that can either be iterated to get hints on steps to follow:
sage: from sage.symbolic.integration.manual import ManualIntegral sage: M = ManualIntegral(exp(x)*sin(x), x) sage: M.hint() (u == sin(x), dv == e^x, du == cos(x), v == integrate(e^x, x), integrate(e^x*sin(x), x) == v*sin(x) - integrate(v*cos(x), x)) sage: M.hint() (integrate(e^x, x) == e^x,) sage: M.hint() (u == cos(x), dv == e^x, du == -sin(x), v == integrate(e^x, x), integrate(cos(x)*e^x, x) == v*cos(x) - integrate(-v*sin(x), x)) sage: M.hint() (integrate(e^x, x) == e^x,) sage: M.hint() (integrate(e^x*sin(x), x) == -cos(x)*e^x + e^x*sin(x) - integrate(e^x*sin(x), x), 2*integrate(e^x*sin(x), x) == -cos(x)*e^x + e^x*sin(x))
Also, all hints can be listed at once:
sage: M.all_hints() [(u == sin(x), dv == e^x, du == cos(x), v == integrate(e^x, x), integrate(e^x*sin(x), x) == v*sin(x) - integrate(v*cos(x), x)), (integrate(e^x, x) == e^x,), (u == cos(x), dv == e^x, du == -sin(x), v == integrate(e^x, x), integrate(cos(x)*e^x, x) == v*cos(x) - integrate(-v*sin(x), x)), (integrate(e^x, x) == e^x,), (integrate(e^x*sin(x), x) == -cos(x)*e^x + e^x*sin(x) - integrate(e^x*sin(x), x), 2*integrate(e^x*sin(x), x) == -cos(x)*e^x + e^x*sin(x))]
Change History (2)
comment:1 Changed 3 years ago by
- Branch set to u/mmarco/manualintegrate
comment:2 Changed 3 years ago by
- Commit set to 9824f80aee60f09d2e6faeaf30b3a7640c77107a
- Component changed from PLEASE CHANGE to symbolics
- Description modified (diff)
- Keywords integration education added
- Type changed from PLEASE CHANGE to enhancement
Note: See
TracTickets for help on using
tickets.
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:
First implementation
Complete docstrings and tests.