On Dec 22, 5:08 pm, Maxim <[email protected]> wrote:
> Hi all!
>
> I'm trying to do something which I haven't seen any examples so far :
> symbolic convolution. I know I can use lists or Piecewise defined
> functions to do a convolution, but here my interest is the symbolic
> solution.
>
> To illustrate an example, I would like to make a function that would
> do something like that :
>
> def conv(func1,func2):
> # variable change
> var('t')
> h(tau)=func1(tau)
> x(tau)=func2(-tau+t)
> # proper convolution returns y(t)
> y(t) = integrate(h(tau)*x(tau),tau,-infinity,+infinity)
> return y(t)
>
<SNIP>
I do not know sage well enough, but can't one in Sage just pass the
independent variable, say "t", as an additional argument to the conv()
function and inside the conv() function, simply write the definition
of the convolution integral?
This is the convolution of your 2 given functions
unit_step(t), exp(-0.5*t)*unit_step(t)
So, in Mathematica, I write the following 4 lines of code:
f1[t_] := UnitStep[t]
f2[t_] := Exp[-0.5*t]*UnitStep[t]
conv[f1_, f_, t_] := Integrate[ f1[tao]* f2[t - tao], {tao, -
Infinity, Infinity} ]
(*now do the convolution*)
conv[f1, f2, t]
Out[11]= (2. - 2./E^(0.5*t))*UnitStep[t]
The above is y(t).
Can't the above be translated to Sage?
--Nasser
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org