Hello,
In teaching ODE we do a unit on Laplace transforms. In addition to the
usual transforms and inverse transforms, we also do transforms for step
functions.
I did not see this in maxima (if it is already there, please tell me
what the corresponding commands are), so I wrote two smple functions to
do the laplace transform and corresponding inverse transform.
Note: maxima does do
laplace(delta(t-a),t,s),
but I could not get it to handle laplace(unit_step(t-3)*exp(t-3), t,s)
for instance.
The code is as follows. the name 'lap_us' is for 'laplace_unit_step)
lap_us(a,f):= exp(-s*a)*laplace(ev(f,t=t+a),t,s)$
and
ilap_us(a,t):= unit_step(t+a)*ev(ilt(F/exp(a*s),s,t),t=t+a)$
Typical examples:
(%i6) lap_us(2,exp(t-2));
(%o6) %e^-(2*s)/(s-1)
(%i7) ilap_us(-2,%);
(%o7) %e^(t-2)*unit_step(t-2)
I would like to put this in something better. For the direct transform,
I would like to have a routine 'lap' which takes an expression which may
be a sum of standard functions and those with unit step factors and
produces the associated transform.
For instance, it would do something like
lap( t^3 + 3*exp(-3*t) + unit_step(t-1)*(t-1)^2 -
unit_step(t-3)*(t-3), t, s)
and produce the Laplace transform as
(%i15) laplace(t^3 + 3*exp(-3*t),t,s) + lap_us(1,(t-1)^2) - lap_us(3,t-3);
(%o15) 2*%e^-s/s^3-%e^-(3*s)/s^2+3/(s+3)+6/s^4
As it stands now, I have to do the summands separately.
Is there a simple way to parse the arguments so as to make the function
'lap' in a simple manner from the above pieces (or is there a better way
to do this)?
Any suggestions would be welcome.
TIA,
-sen