[GiNaC-devel] Powers of exponents
Vladimir V. Kisil
kisilv at maths.leeds.ac.uk
Thu Oct 1 17:21:18 CEST 2009
Dear Richard,
>>>>> On Wed, 30 Sep 2009 23:39:25 +0200, "Richard B. Kreckel" <kreckel at ginac.de> said:
RK> The rewriting rule pow(exp(x),a) -> exp(a*x) is not correct in
RK> the general complex case. Consider a=1/2 and x=-I*Pi, for
RK> instance.
Thanks for pointing out this. I am attaching a patch which do the
substitution only for real x and a.
Best wishes,
Vladimir
--
Vladimir V. Kisil email: kisilv at maths.leeds.ac.uk
-- www: http://maths.leeds.ac.uk/~kisilv/
-------------- next part --------------
--- inifcns_trans.cpp 2009-02-17 13:39:22.000000000 +0000
+++ patches/inifcns_trans.cpp 2009-10-01 16:03:58.000000000 +0100
@@ -99,9 +99,18 @@
return exp(GiNaC::real_part(x))*sin(GiNaC::imag_part(x));
}
+static ex exp_power(const ex & x, const ex & a)
+{
+ if (x.info(info_flags::real) && a.info(info_flags::real))
+ return exp(x*a);
+
+ return power(exp(x), a).hold();
+}
+
REGISTER_FUNCTION(exp, eval_func(exp_eval).
evalf_func(exp_evalf).
derivative_func(exp_deriv).
+ power_func(exp_power).
real_part_func(exp_real_part).
imag_part_func(exp_imag_part).
latex_name("\\exp"));
More information about the GiNaC-devel
mailing list