<code>
from sympy import *
import itertools as it
import operator as op

def byparts(expr,x,depth=1):
    print depth
    hintarr=[]
    if expr.is_Mul:
        for part in it.combinations(expr.args,depth):
            part=reduce(op.mul,part)
            rest=simplify(expr/part)
            part_int=integrate(part,x)
            #print part_int,rest
            hint=simplify(part_int*diff(rest,x))
            integral=rest*part_int
            hintarr=hintarr+[(hint,integral)]
            
    hintarr=hintarr+[(x*diff(expr,x),x*expr)]
    return(dict(hintarr))

def integrate2(expr,x,depth=1):
    if expr.is_Add:
        for part in expr.args:
            rest=simplify(expr-part)
            
            for depth in range(1,len(part.args)+1):
                byparts_dict=byparts(part,x,depth)
                #print rest, list(byparts_dict)
                if rest in byparts_dict:
                    return(byparts_dict[rest])
<\code>

On Wednesday, July 11, 2012 1:23:01 PM UTC-4, pallab wrote:
>
> simple by parts integral can not be done:
>
> integrate(diff(x*f(x),x),x)
>
>
> also can not do simple integral like:
>
> integrate(diff(x*sqrt(sin(x)),x),x)
>
>
> best,
>
> Pallab
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sympy/-/kqWwCQXDF1YJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to