|
From: Richard F. <fa...@gm...> - 2024-11-28 18:09:21
|
The term 'integration' has many different contexts. In Maxima (previously
Macsyma),
the term was used for "antidifferentiation" of explicit expressions formed
by
composition of elementary functions including +, *, /, ^, log, exp, sin,
cos, etc.
This was extended to definite integration in 2 ways. 1. Application of the
fundamental theorem of integral calculus [ plug in the limits] and 2.
definite
integration in the complex plane by contour integration. [ thesis by P. Wang
at MIT].
Other definitions of integration come in through numerical quadrature.
Yet other definitions can be introduced beyond this Riemann integration.
Lesbesgue integration perhaps.
Joel Moses wrote the core of the code used for Macsyma integration,
described in his thesis on Symbolic Integration (SIN), but it has been
much modified. (Moses referred to his code as "Original SIN").
It is probably least effort to just try out integrate (... whatever...) and
see
what happens, but if it doesn't work, maybe consider if you might alter
your command to ask something less challenging to the program.
(quadrature, laplace transform, fourier transform, expansion in Taylor
series,
Chebyshev series, etc.)
Definite numerical integration and plot() have a certain similarity in that
they
each rely on evaluation of a function, say f, at many points. It may be
plausible to compile f into machine code for faster quadrature or plotting.
In the simplest cases, where f is a function of a single floating-point
real number.
The problem users often encounter with plot, is confusing a function with an
expression. Consider f(x):= if symbolp(x) then 0 else 1;
plot2d(f,[x,-2,2]) is a straight line y=1 because f is always called on
a number.
plot2d(f(x),[x,-2,2]) is a straight line y=0. f(x) is computed as 0 for
symbol x
f is a function
f(x) is an expression. which expression? since x is a symbol, it is 0.
plot2d('f(x),[x,-2,2]) is a straight line y=1. Note the quote... ' f(x)
..
RJF
On Thu, Nov 28, 2024 at 3:56 AM Eduardo Ochs <edu...@gm...> wrote:
> On Thu, 28 Nov 2024 at 04:51, Jaime Villate <vi...@fe...> wrote:
>
>>
>> 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
>>
>
> Hola Jaime!
>
> Thanks! Excellent modulo a bug, that may be between keyboard and chair
> or not... I was expecting h(x)=0 for x<=0, and according to the plot
> we got h(x)=x^2/2 for x<=0. What is going on?
>
> Thanks in advance,
> Eduardo (who has used LTs very little =( )
>
> _______________________________________________
> Maxima-discuss mailing list
> Max...@li...
> https://lists.sourceforge.net/lists/listinfo/maxima-discuss
>
|