I changed the inverse_laplace_transform function in 
sympy.integrals.transforms to first break the given function in partial 
fractions and calculate the inverse_laplace_transform as the sum of 
inverse_laplace_transform of the partial fractions.

def inverse_laplace_transform(F, s, t, plane=None, **hints):

    def part_frac_list(ex):
        fracs = []
        parts = apart_list(ex)
        try:
            for x in parts[2]:
                
fracs.append(assemble_partfrac_list((parts[0],parts[1],[x])))
        except:
            return fracs
        return fracs

    parts_fracs = part_frac_list(F)
    return sum([InverseLaplaceTransform(x.refine(), s, t, 
plane).doit(**hints) for x in parts_fracs])


Now the the function appears to work better


>>> inverse_laplace_transform(2/(s**2*(s**2 + 1)),s,t)
2*t*Heaviside(t) - 2*sin(t)*Heaviside(t)


The integration algorithm can be improved in the same by breaking the 
function into partial fractions. 

The answer for inverse_laplace_transform(ln(s/(s-1)),s,t) is -(1-exp(t))/t. 
It can be evaluated by the observing t*f(t) = -F'(s) where F(s) is the 
laplace transform f(t). 

F(s) = ln(s/(s-1))
F'(s) = (s - 1)*(-s/(s - 1)**2 + 1/(s - 1))/s
inverse_laplace_transform(F'(s)) = t*f(t) = (-exp(t) + 1)

Hence,
f(t) =  -(1-exp(t))/t






-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to