From: Barton W. <wi...@un...> - 2024-11-28 22:37:43
|
(%i1) load(abs_integrate)$ (%i2) f(x) := (signum(x) - signum(x-1))/2$ (%i3) g(x) := x*f(x)$ (%i4) integrate(f(t) * g(x-t),t,0,x); "Is "x" positive, negative or zero?"p; (%o4) (signum(x-2)*signum(x-1)*x^2-2*signum(x-1)*x^2+signum(x-2)*x^2-2*signum(x-2)*signum(x-1)*x+2*signum(x-1)*x-2*signum(x-2)*x+2*x -(signum(x-2)*signum(x-1)*(x-1)^2)/2+(signum(x-1)*(x-1)^2)/2-(signum(x-2)*(x-1)^2)/2+(x-1)^2/2+(signum(x-2)*signum(x-1))/2-signum(x-1)/2+ signum(x-2)/2-1/2)/4 (%i5) integrate(f(t) * g(x-t),t,0,x); "Is "x" positive, negative or zero?"n; (%o5) 0 Also, see https://sourceforge.net/projects/piecewisefunc/ --Barton ________________________________ From: El Observatorio De Matemática <obs...@gm...> Sent: Thursday, November 28, 2024 12:57 To: Andrei Zorine <zoa...@gm...>; Eduardo Ochs <edu...@gm...>; <max...@li...> <max...@li...> Subject: Re: [Maxima-discuss] Integrating piecewise defined functions Caution: Non-NU Email Here is a version of the pw package: https://github.com/jlapeyre/mext/tree/master/packages/pw<https://urldefense.com/v3/__https://github.com/jlapeyre/mext/tree/master/packages/pw__;!!PvXuogZ4sRB2p-tU!A3qyT2ZYs3LXl7V6DWM7fes6dX9tDelXhnHbSCpqgYycc9ctTml9y8Z_rUtMvQz9YvH54PLfyQOy2URadUIVaO1PDQ$> El jue, 28 nov 2024 a las 13:30, Andrei Zorine (<zoa...@gm...<mailto:zoa...@gm...>>) escribió: Hi, Eduardo! There was a PW package by Richard Hennessy. It's still available online if you search, but it's unmaintained and abandoned. The latest version is 6.5. When I tried to use it, it reported a syntax error which I had to fix manually; I removed "_funcs" symbol from the list of block variables inside of 'pwint' function definition. Now it works fine. As to your example, try load(pw)$ f(x) := ''(piecewise( [minf, 0, 0, 1, 1,0, inf], x))$ g(x) := ''(piecewise( [minf, 0, 0, x, 1,0, inf], x))$ pwint(f(t)*g(x-t), t, -2, 2); Best wishes, Andrei Zorine чт, 28 нояб. 2024 г. в 00:59, Eduardo Ochs <edu...@gm...<mailto:edu...@gm...>>: 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... integrate(f(x), x, -2, 4); float(integrate(f(x), x, -2, 4)); The convolution left Maxima even more confused, obviously... Thanks in advance! Eduardo Ochs http://anggtwu.net/eev-maxima.html<https://urldefense.com/v3/__http://anggtwu.net/eev-maxima.html__;!!PvXuogZ4sRB2p-tU!A3qyT2ZYs3LXl7V6DWM7fes6dX9tDelXhnHbSCpqgYycc9ctTml9y8Z_rUtMvQz9YvH54PLfyQOy2URadUKVpdPbyg$> http://anggtwu.net/eev-qdraw.html<https://urldefense.com/v3/__http://anggtwu.net/eev-qdraw.html__;!!PvXuogZ4sRB2p-tU!A3qyT2ZYs3LXl7V6DWM7fes6dX9tDelXhnHbSCpqgYycc9ctTml9y8Z_rUtMvQz9YvH54PLfyQOy2URadUIEonogqg$> _______________________________________________ Maxima-discuss mailing list Max...@li...<mailto:Max...@li...> https://lists.sourceforge.net/lists/listinfo/maxima-discuss<https://urldefense.com/v3/__https://lists.sourceforge.net/lists/listinfo/maxima-discuss__;!!PvXuogZ4sRB2p-tU!A3qyT2ZYs3LXl7V6DWM7fes6dX9tDelXhnHbSCpqgYycc9ctTml9y8Z_rUtMvQz9YvH54PLfyQOy2URadULV_l8O4w$> _______________________________________________ Maxima-discuss mailing list Max...@li...<mailto:Max...@li...> https://lists.sourceforge.net/lists/listinfo/maxima-discuss<https://urldefense.com/v3/__https://lists.sourceforge.net/lists/listinfo/maxima-discuss__;!!PvXuogZ4sRB2p-tU!A3qyT2ZYs3LXl7V6DWM7fes6dX9tDelXhnHbSCpqgYycc9ctTml9y8Z_rUtMvQz9YvH54PLfyQOy2URadULV_l8O4w$> |