[GiNaC-devel] New in GiNaC: step function

Chris Dams Chris.Dams at mi.infn.it
Thu Mar 9 18:10:51 CET 2006


Dear Vladimir,

On Thu, 2006-03-09 at 16:31 +0000, Vladimir Kisil wrote:
> >>>>> "CD" == Chris Dams <Chris.Dams at mi.infn.it> writes:
>     CD> ignored. Furthermore step(0)=1/2. This, however, should not be
>     CD> taken too seriously as there is also the automatic evaluation
>     CD> step(x)^2 -> step(x). 
> 
> 	For a bigger consistency I would prefer to have either step(0)=0 or
>   step(0)=1. Such a small features which is easy to overlook sometimes
>   takes hours to realise. 

Yes, that is a good point. I made step(0) equal to 1.

>   If three-values are really needed we may have another function
>   sign(x)=1, x>0
>   sign(x)=0, x=0
>   sign(x)=-1, x<0

That function already more or less exists as csgn(x). The reason that it
is useful to have both functions is that the combination (csgn(x)+1)/2
is kept together even when expanding and so on if one writes it as
step(x). When looking at output it is more easy to see that step(P)*Q
does not contribute if one knows that P happens to be negative then it
is when it is to be canceled by another term equal to Q.

Best wishes,
Chris



More information about the GiNaC-devel mailing list