Reputation: 3792
In doc of sympy http://docs.sympy.org/latest/modules/integrals/integrals.html we can read:
The manualintegrate module has functions that return the steps used (see the module docstring for more information).
but calling help(sympy.integrals.manualintegrate)
we get:
Help on function manualintegrate in module sympy.integrals.manualintegrate:
manualintegrate(f, var)
manualintegrate(f, var)
Compute indefinite integral of a single variable using an algorithm that
resembles what a student would do by hand.
Unlike ``integrate``, var can only be a single symbol.
Examples
========
>>> from sympy import sin, cos, tan, exp, log, integrate
>>> from sympy.integrals.manualintegrate import manualintegrate
>>> from sympy.abc import x
>>> manualintegrate(1 / x, x)
log(x)
>>> integrate(1/x)
log(x)
>>> manualintegrate(log(x), x)
x*log(x) - x
>>> integrate(log(x))
x*log(x) - x
>>> manualintegrate(exp(x) / (1 + exp(2 * x)), x)
atan(exp(x))
>>> integrate(exp(x) / (1 + exp(2 * x)))
RootSum(4*_z**2 + 1, Lambda(_i, _i*log(2*_i + exp(x))))
>>> manualintegrate(cos(x)**4 * sin(x), x)
-cos(x)**5/5
>>> integrate(cos(x)**4 * sin(x), x)
-cos(x)**5/5
>>> manualintegrate(cos(x)**4 * sin(x)**3, x)
cos(x)**7/7 - cos(x)**5/5
>>> integrate(cos(x)**4 * sin(x)**3, x)
cos(x)**7/7 - cos(x)**5/5
>>> manualintegrate(tan(x), x)
-log(cos(x))
>>> integrate(tan(x), x)
-log(sin(x)**2 - 1)/2
See Also
========
sympy.integrals.integrals.integrate
sympy.integrals.integrals.Integral.doit
sympy.integrals.integrals.Integral
I don't see step by step solution.
Upvotes: 6
Views: 5129
Reputation: 29
Following the tip from user6655984, I was able to adjust the Sympy Gama formatting code to output to the console in LaTex format. I'm still working on getting every rule to translate correctly, but here is what I have for now: sympy gama
Hope this helps!
Upvotes: 0
Reputation:
You are looking at the docstring of the function manualintegrate, not of the module manualintegrate. The module is here and it says
This module also provides functionality to get the steps used to evaluate a particular integral, in the
integral_steps
function. This will return nested namedtuples representing the integration rules used.
The integral_steps
function is documented thus:
Returns the steps needed to compute an integral. This function attempts to mirror what a student would do by hand as closely as possible. SymPy Gamma uses this to provide a step-by-step explanation of an integral. The code it uses to format the results of this function can be found at https://github.com/sympy/sympy_gamma/blob/master/app/logic/intsteps.py.
Unless you are using SymPy Gamma, the output of integral_steps
will be hard to read. Example:
from sympy.integrals.manualintegrate import integral_steps
integral_steps(x*sin(3*x), x)
returns
PartsRule(u=x, dv=sin(3*x), v_step=URule(u_var=_u, u_func=3*x, constant=1/3, substep=ConstantTimesRule(constant=1/3, other=sin(_u), substep=TrigRule(func='sin', arg=_u, context=sin(_u), symbol=_u), context=sin(_u), symbol=_u), context=sin(3*x), symbol=x), second_step=ConstantTimesRule(constant=-1/3, other=cos(3*x), substep=URule(u_var=_u, u_func=3*x, constant=1/3, substep=ConstantTimesRule(constant=1/3, other=cos(_u), substep=TrigRule(func='cos', arg=_u, context=cos(_u), symbol=_u), context=cos(_u), symbol=_u), context=cos(3*x), symbol=x), context=-cos(3*x)/3, symbol=x), context=x*sin(3*x), symbol=x)
It's much more readable on SymPy Gamma site.
Upvotes: 7