[Maxima] Square pulse function?
villate at fe.up.pt
Thu May 29 14:03:54 CDT 2008
On Thu, 2008-05-29 at 18:58 +0100, Paul wrote:
> is it possible to define a function on the reals, say g(t), that is
> equal to 1 for -1/2 <= t <= 1/2 and 0 otherwise, that integrate knows
> how to handle (for definite
> Trying the obvious with if-then-else doesn't seem to work.
This is "almost" what you want (see note at the end):
(%i16) g(t):= (signum(t+1/2)-signum(t-1/2))/2$
(%o20) [.5000000000000001, 5.551115123125784e-16, 273, 0]
(%o21) [1.0, 1.110223024625157e-15, 567, 0]
(%o22) [0.0, 0.0, 21, 0]
The result of the integral is the first element in the list returned by
quad_qags. integrate does not work because it tries to find the
indefinite integral first, to calculate the definite integral. quad_qags
uses an approximate numerical method.
The g(x) above is equal to 1/2 in t=+-1/2, and not 1 as you wanted.
unit_step could be used instead of signum, but quad_qags doesn't work
More information about the Maxima