[Maxima] laplace transform
Dieter Kaiser
drdieterkaiser at web.de
Thu Feb 26 16:24:10 CST 2009
Am Donnerstag, den 26.02.2009, 13:47 -0700 schrieb Robert Dodier:
> On Thu, Feb 26, 2009 at 12:20 PM, Dieter Kaiser <drdieterkaiser at web.de> wrote:
>
> > I have tried today a bit of code to call specint when laplace don't get
> > an answer. It works well. If it is of interest I could present an
> > extension of laplace to call $specint and commit it.
>
> Yes, please do.
Here is some code which calls $specint when laplace fails. I have
introduced a function check-call-to-$specint which is called before we
return a result from laplace:
(defmfun $laplace (fun var parm)
(setq fun (mratcheck fun))
(cond ((or nounsflag (member '%laplace nounl :test #'eq))
(setq fun (remlaplace fun))))
(cond ((and (null (atom fun)) (eq (caar fun) 'mequal))
(list '(mequal simp)
(check-call-to-$specint (laplace (cadr fun)) fun var parm)
(check-call-to-$specint (laplace (caddr fun)) fun var parm)))
(t
(check-call-to-$specint (laplace fun) fun var parm))))
This could be the functions which does a check for a call to $specint:
(defun check-call-to-$specint (result fun var parm)
(let ((res))
(cond
((isinop result '%laplace)
;; laplace returns a noun form. Try $specint
(let ((res ($specint (mul fun (power '$%e (mul -1 var parm)))
var)))
(if (isinop res '$specint)
;; $specint has not found a result.
result
;; $specint has found a result
res)))
(t result))))
Here is an example with a bessel function:
(%i7) laplace(bessel_j(n,t),t,s);
Is s positive, negative, or zero?
p;
(%o7) s^(-n-1)/((sqrt(1/s^2+1)+1)^n*sqrt(1/s^2+1))
And now gamma_incomplete:
(%i8) laplace(gamma_incomplete(n,t),t,s);
Is s positive, negative, or zero?
p;
(%o8) gamma(n)/s-gamma(n+1)*s^(-n-1)/(n*(1/s+1)^n)
We have one problem:
It is not possible to define the parameter s of the laplace
transformation to be positive. The reason is the function lapdefint.
First this functions sets the parameter of the laplace transformation to
be positive too. But later this fact is killed.
(meval `(($assume) ,@(list (list '(mgreaterp) parm 0))))
(setq tryint (errset ($defint mult var 0 '$inf)))
(meval `(($forget) ,@(list (list '(mgreaterp) parm 0))))
Therefore we loose our fact too and when we enter the routine $specint
Maxima no longer knows that the parameter is assumed to be positive.
Perhaps we should modify this piece of code. Most consistent would be
not to assume the parameter to be positive, but to ask the sign.
Dieter Kaiser
More information about the Maxima
mailing list