| Author |
Comment/Response |
Rayne
|
02/22/07 11:45pm
Hi,
I'm trying to implement the Laplace transform using rule-based Mathematica programming with properties of the Laplace transform.
I have the folloing code:
l[c_, t_, s_] := c/s /;FreeQ[c,t];
l[a_+b_, t_, s_] := l[a,t,s] + l[b,t,s];
l[c_ a_, t_, s_] := c l[a,t,s] /; FreeQ[c,t];
l[t_^n_Integer, t_, s_] := n!/s^(n+1) /; n>0;
l[a_ t_^n_Integer, t_, s_] := (-1)^n D[l[a,t,s],{s,n}] /; n>0;
but for some reason, the line
l[t_^n_Integer, t_, s_] := n!/s^(n+1) /; n>0;
does not seem to work when n = 1, i.e. l[t,t,s].
It works for other positive n values, such as
l[t^2,t,s] Output: 2/s^3
l[t^3,t,s] Output: 6/s^4
l[2t^2,t,s] Output: 4/s^3
but for l[t,t,s], it gives me l[t,t,s] again. Or l[2t,t,s] gives 2 l[t,t,s].
I simply cannot see what is wrong with that line of code.
Please advise.
Thank you,
Regards,
Rayne
URL: , |
|