I haven't used sympy's Laplace transform code but I can tell you that
dsolve is able to solve the differential equation:
In [14]: y = Function('y')
In [15]: t = Symbol('t')
In [16]: g = 8*t*(Heaviside(t) - Heaviside(t-5)) + 40*Heaviside(t-5)
In [17]: eq = Eq(y(t).diff(t, 2) + 4*y(t), g)
In [18]: str(eq)
Out[18]: 'Eq(4*y(t) + Derivative(y(t), (t, 2)), 8*t*(Heaviside(t) -
Heaviside(t - 5)) + 40*Heaviside(t - 5))'
In [19]: str(dsolve(eq))
Out[19]: 'Eq(y(t), 2*(t*Heaviside(t) + 5*Heaviside(t - 5))*cos(2*t)**2
+ (C1 - 10*cos(10)*Heaviside(t - 5) +
4*Integral(t*sin(2*t)*Heaviside(t - 5), t))*cos(2*t) +
2*(t*Heaviside(t) - t*Heaviside(t - 5) + 5*Heaviside(t -
5))*sin(2*t)**2 + (C2 - cos(2*t)*Heaviside(t - 5) - Heaviside(t) +
cos(10)*Heaviside(t - 5))*sin(2*t))'
There is an unevaluated integral in there and it's quite slow because
of computing the integrals involved so there can be improvements to
made to the integration routines here.
Not having used sympy's laplace transforms before I'm not sure how
they would be used for a case like this:
In [24]: s = Symbol('s')
In [25]: str(laplace_transform(eq.lhs - eq.rhs, t, s))
Out[25]: '(4*LaplaceTransform(y(t), t, s) +
LaplaceTransform(Derivative(y(t), (t, 2)), t, s) - 40*exp(-5*s)/s +
8*(5*s - exp(5*s) + 1)*exp(-5*s)/s**2, 0, True)'
I guess that `LaplaceTransform(Derivative(y(t), (t, 2)), t, s)` is an
unevaluated Laplace transform of the derivative. How exactly does
Matlab represent that?
Oscar
> --
> 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+un...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/10568891-8a24-43aa-8f93-e1a6b7de72e6n%40googlegroups.com.