Hi!
I reimplemented the Inverse Laplace Transform to make it work on more inputs
like:
(%i12) invlaptrans(exp(-s*2)*2*s^2/(s^2+2),s,t);
(%o12) 2*delta(t-2)-2*sqrt(2)*unit_step(t-2)*sin(sqrt(2)*t-2*sqrt(2))
and ratio of polynomials whose denominator has more then linear and quadratic
factors.
Maybe laplace should be extended, because it don't know about unit_step at
this time, but I don't know how to do this.
Norbert
-------------- next part --------------
remvalue(s,t);
unit_step(x):=1/2*(1+signum(x));
matchdeclare(f, all);
matchdeclare(A, lambda([x], freeof(t,x) and (not freeof(s,x)) and polynomialp(num(ratsimp(x)),[s]) and polynomialp(num(ratsimp(x)),[s]) and hipow(num(ratsimp(x)),s)<=hipow(denom(ratsimp(x)),s)));
matchdeclare(F, lambda([x], freeof(t,x) and (not freeof(s,x)) and polynomialp(num(ratsimp(x)),[s]) and polynomialp(num(ratsimp(x)),[s]) and hipow(num(ratsimp(x)),s)<hipow(denom(ratsimp(x)),s)));
matchdeclare(tau, lambda([x],freeof(s,t,x) and x>0));
matchdeclare(a, lambda([x],freeof(s,t,x)));
defrule(ir0,ilt0(a,s,t),a*delta(t));
defrule(ir1,ilt0(F,s,t),block(
[return:0, G ,s_p],
G: ratsimp(F),
s_p: solve(denom(G)=0,s),
disp(s_p),
for i:1 thru length(s_p) do return: return+residue(G*exp(s*t),s,rhs(s_p[i])),
return*'unit_step(t)));
defrule(ir2,ilt0(A,s,t),invlaptrans(ratsimp(A-limit(A,s,inf)),s,t)+limit(A,s,inf)*delta(t));
defrule(ir3,ilt0(exp(-s*tau)*f,s,t),invlaptrans(f,s,t-tau));
declare(ilt0,linear);
invlaptrans(f,s,t):=ratsimp(ev(apply1(ilt0(expandwrt(f,%e),s,t),ir0,ir1,ir2,ir3),diff,subst,demoivre));