[GiNaC-devel] New in GiNaC: step function

Vladimir Kisil kisilv at maths.leeds.ac.uk
Thu Mar 9 18:31:50 CET 2006


>>>>> "CD" == Chris Dams <Chris.Dams at mi.infn.it> writes:
    CD> That function already more or less exists as csgn(x).

	I missed it. Should we add its power property like that: 

static ex csgn_power(const ex & arg, const ex & exp)
{
	if (is_a<numeric>(exp) && exp.info(info_flags::positive)) {
		if (ex_to<numeric>(exp).is_odd())
			return csgn(arg);
		else
			return power(csgn(arg), _ex2).hold();
	} else
		return power(csgn(arg), exp).hold();
}

	
    CD>  The reason that it is useful to have both functions

	Yes, I agree. So far I used home-brewed definition in
  http://arxiv.org/abs/cs.MS/0512073, now I can switch to the "official" one. ;-)

    CD> (csgn(x)+1)/2 is kept together even when expanding and so on if
    CD> one writes it as step(x). When looking at output it is more easy

	I agree again. My comment was intended only for the case, when the
  intermediate value is important. 

  Best wishes,
  Vladimir 
-- 
Vladimir V. Kisil     email: kisilv at maths.leeds.ac.uk
--                      www: http://maths.leeds.ac.uk/~kisilv/


More information about the GiNaC-devel mailing list