[GiNaC-devel] New in GiNaC: step function

Vladimir Kisil kisilv at maths.leeds.ac.uk
Fri Mar 10 22:43:02 CET 2006


> For example csgn(x)^(1/2) where it later turns out that x==-1.  

Now I see the ommision, this one should be better:

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

Best,
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