[GiNaC-devel] Powers of exponents
Vladimir V. Kisil
kisilv at maths.leeds.ac.uk
Thu Oct 1 22:57:14 CEST 2009
>>>>> On Thu, 01 Oct 2009 10:49:03 -0500, Stephen Montgomery-Smith <stephen at missouri.edu> said:
SMS> It will also be true for arbitrary x if a is an integer.
Good point! The third iteration of the patch is attached.
--
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 21:04:09.000000000 +0100
@@ -99,9 +99,19 @@
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::integer) || 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