From: Jaime V. <vi...@fe...> - 2024-11-28 07:52:03
|
On 27/11/24 21:56, Eduardo Ochs wrote: > Hi list, > > what is the recommended way to integrate piecewise defined > functions? I tried this, > > f(x) := if x<0 then 0 > elseif x<1 then 1 > else 0; > g(x) := if x<0 then 0 > elseif x<1 then x > else 0; > h(x) := integrate(f(t)*g(x-t), t, -2, +2); > > and I couldn't find a way to make Maxima calculate this > integral... Hello Eduardo, If you mean the convolution of f and g: h(x) := integrate(f(x)*g(x-t), t, 0, x) I recommend that you use Laplace transforms and expressions, rather than "functions": f: hstep (x) - hstep (x-1); g: (hstep (x) - hstep (x-1))*x; F: laplace (f,x,s); G: laplace (g,x,s); H: F*G; h: pwilt (H,s,x); plot2d ([f,g,h], [x,-2,2], [legend,"f(x)","g(x)","h(x)"]); Cumprimentos, Jaime |