[GiNaC-devel] Powers of exponents
Vladimir V. Kisil
kisilv at maths.leeds.ac.uk
Fri Oct 2 16:48:29 CEST 2009
>>>>> On Fri, 02 Oct 2009 07:11:51 -0500, Stephen Montgomery-Smith <stephen at missouri.edu> said:
SMS> I think it is wrong to include "x is an integer." Even 1^i
SMS> (which is exp(0)^i) is not well defined (it can be any of e^(2
SMS> pi n) for all integers).
Alright, here is the patch to stay on the safe side.
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-02 15:45:17.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 (a.info(info_flags::integer) || (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