inifcns_trans.cpp (ginac-1.7.11.tar.bz2) | : | inifcns_trans.cpp (ginac-1.8.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 131 | skipping to change at line 131 | |||
{ | { | |||
return exp(GiNaC::real_part(x))*sin(GiNaC::imag_part(x)); | return exp(GiNaC::real_part(x))*sin(GiNaC::imag_part(x)); | |||
} | } | |||
static ex exp_conjugate(const ex & x) | static ex exp_conjugate(const ex & x) | |||
{ | { | |||
// conjugate(exp(x))==exp(conjugate(x)) | // conjugate(exp(x))==exp(conjugate(x)) | |||
return exp(x.conjugate()); | return exp(x.conjugate()); | |||
} | } | |||
static ex exp_power(const ex & x, const ex & a) | ||||
{ | ||||
/* | ||||
* The power law (e^x)^a=e^(x*a) is used in two cases: | ||||
* a) a is an integer and x may be complex; | ||||
* b) both x and a are reals. | ||||
* Negative a is excluded to keep automatic simplifications like exp(x)/e | ||||
xp(x)=1. | ||||
*/ | ||||
if (a.info(info_flags::nonnegative) | ||||
&& (a.info(info_flags::integer) || (x.info(info_flags::real) && a.inf | ||||
o(info_flags::real)))) | ||||
return exp(x*a); | ||||
else if (a.info(info_flags::negative) | ||||
&& (a.info(info_flags::integer) || (x.info(info_flags::real) && | ||||
a.info(info_flags::real)))) | ||||
return power(exp(-x*a), _ex_1).hold(); | ||||
return power(exp(x), a).hold(); | ||||
} | ||||
REGISTER_FUNCTION(exp, eval_func(exp_eval). | REGISTER_FUNCTION(exp, eval_func(exp_eval). | |||
evalf_func(exp_evalf). | evalf_func(exp_evalf). | |||
expand_func(exp_expand). | expand_func(exp_expand). | |||
derivative_func(exp_deriv). | derivative_func(exp_deriv). | |||
real_part_func(exp_real_part). | real_part_func(exp_real_part). | |||
imag_part_func(exp_imag_part). | imag_part_func(exp_imag_part). | |||
conjugate_func(exp_conjugate). | conjugate_func(exp_conjugate). | |||
power_func(exp_power). | ||||
latex_name("\\exp")); | latex_name("\\exp")); | |||
////////// | ////////// | |||
// natural logarithm | // natural logarithm | |||
////////// | ////////// | |||
static ex log_evalf(const ex & x) | static ex log_evalf(const ex & x) | |||
{ | { | |||
if (is_exactly_a<numeric>(x)) | if (is_exactly_a<numeric>(x)) | |||
return log(ex_to<numeric>(x)); | return log(ex_to<numeric>(x)); | |||
skipping to change at line 200 | skipping to change at line 219 | |||
const relational &rel, | const relational &rel, | |||
int order, | int order, | |||
unsigned options) | unsigned options) | |||
{ | { | |||
GINAC_ASSERT(is_a<symbol>(rel.lhs())); | GINAC_ASSERT(is_a<symbol>(rel.lhs())); | |||
ex arg_pt; | ex arg_pt; | |||
bool must_expand_arg = false; | bool must_expand_arg = false; | |||
// maybe substitution of rel into arg fails because of a pole | // maybe substitution of rel into arg fails because of a pole | |||
try { | try { | |||
arg_pt = arg.subs(rel, subs_options::no_pattern); | arg_pt = arg.subs(rel, subs_options::no_pattern); | |||
} catch (pole_error) { | } catch (pole_error &) { | |||
must_expand_arg = true; | must_expand_arg = true; | |||
} | } | |||
// or we are at the branch point anyways | // or we are at the branch point anyways | |||
if (arg_pt.is_zero()) | if (arg_pt.is_zero()) | |||
must_expand_arg = true; | must_expand_arg = true; | |||
if (arg.diff(ex_to<symbol>(rel.lhs())).is_zero()) { | if (arg.diff(ex_to<symbol>(rel.lhs())).is_zero()) { | |||
throw do_taylor(); | throw do_taylor(); | |||
} | } | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 23 lines changed or added |