unit_step (was Re: New piecewise package indevelopment)
Subject: unit_step (was Re: New piecewise package indevelopment)
From: Richard Hennessy
Date: Fri, 21 Nov 2008 20:55:33 -0500
Barton,
I want to kidnap your unit_blip code for the case when pwexpand= 'signum if you don't mind. Then everything will be signum
including kron_delta, abs(x) and anything else I can think of. BTW the derivitive of abs(x) is signum(x) except maybe at zero. At
least that one is easy.
Rich
----- Original Message -----
From: "Richard Hennessy" <rvh2007 at comcast.net>
To: "Barton Willis" <willisb at unk.edu>; "Maxima List" <maxima at math.utexas.edu>
Sent: Thursday, November 20, 2008 9:38 PM
Subject: Re: [Maxima] unit_step (was Re: New piecewise package indevelopment)
Hi,
You can use the kron_delta(x,a) function for unit_blip(x-a).
As for closed and open intervals, unit_step is right closed and left open. There is another way to fix that.
For both open
expr*(unit_step(x-4) - unit_step(x-8) - kron_delta(x,8))
For both closed
expr*(unit_step(x-4) - unit_step(x-8) + kron_delta(x,4))
For right open and left closed.
expr*(unit_step(x-4) - unit_step(x-8) +kron_delta(x,4) - kron_delta(x,8))
This is how I have decided to do it in pw.mac. I also have a switch to use,
pwexpand:unit_step
causes Maxima to use unit_step and
pwexpand:signum
causes Maxima to use signum. I am still working on the simplification rules for signum and kron_delta. I have most of
them right but there are still some problems with some of them.
Also (abs(x)+x)/(2*x) is another way but it explodes at zero, so I am not using that.
Rich
----- Original Message -----
From: "Barton Willis" <willisb at unk.edu>
To: "Maxima List" <maxima at math.utexas.edu>
Sent: Sunday, November 09, 2008 12:39 PM
Subject: unit_step (was Re: New piecewise package in development)
>Also, I believe that the orthogonal polynomial package has a "unit_step"
>function, though I don't know whether its left-continuous nature is
>compatible with what you need.
Maybe unit_step in orthopoly should be changed to exclusively use
signum. Otherwise, we get too many related functions with non-local
simplifications. Something like (lightly tested):
unit_step_right_continuous(x) := block([s : signum(x)], s *(1-s) / 2 + 1);
unit_step_left_continuous(x) := block([s : signum(x)], s * (1 + s) / 2);
unit_ramp(x) := (x + abs(x))/2;
unit_blip(x) := block([s : signum(x)], (1 + s) * (1 - s));
unit_pulse(x, left ,right) :=
if is(left = 'open) then (
if is(right = 'open) then unit_step_left_continuous(x) -
unit_step_right_continuous(x-1)
else if right = 'closed then unit_step_left_continuous(x) -
unit_step_left_continuous(x-1)
else error("The third argument to unit_pulse must be closed or open"))
else if is(left = 'closed) then (
if is(right = 'open) then unit_step_right_continuous(x) -
unit_step_right_continuous(x-1)
else if right = 'closed then unit_step_right_continuous(x) -
unit_step_left_continuous(x-1)
else error("The third argument to unit_pulse must be closed or open"))
else error("The second argument to unit_pulse must be closed or open");
Short test:
(%i78) map(lambda([s], unit_pulse(s, 'closed, 'open)),[0,1]);
(%o78) [1,0]
(%i79) map(lambda([s], unit_pulse(s, 'closed, 'closed)),[0,1]);
(%o79) [1,1]
(%i80) map(lambda([s], unit_pulse(s, 'open, 'open)),[0,1]);
(%o80) [0,0]
(%i81) map(lambda([s], unit_pulse(s, 'open, 'closed)),[0,1]);
(%o81) [0,1]
(%i82) unit_step_left_continuous(0);
(%o82) 0
(%i83) unit_step_right_continuous(0);
(%o83) 1
(%i84) map('unit_blip, [-1,0,42]);
(%o84) [0,1,0]
unit_pulse(x, 'closed, 'closed) is a mess, but so it goes:
(%i85) unit_pulse(x, 'closed, 'closed);
(%o85) ((1-signum(x))*signum(x))/2-(signum(x-1)*(signum(x-1)+1))/2+1
(%i86) unit_pulse(x, 'closed, 'open);
(%o86) ((1-signum(x))*signum(x))/2-((1-signum(x-1))*signum(x-1))/2
A nonlocal simplification (that would be hard to do without uniformly
using signum for all these functions:
(%i93) is(equal(unit_step_right_continuous(x) - unit_step_left_continuous
(x), unit_blip(x)));
(%o93) true
Barton
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima