X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Ffunction.cppy;h=dba9f4e0f096b8234234e540c109484ebdf260f8;hb=679208b372d0d1ba9a50cf277530bf0950cb3a90;hp=ce38045f96150add137a0de4d84ce41cf2373001;hpb=798d53ebb4da4e8e3865ed7bd7f31412fe2be3a7;p=ginac.git diff --git a/ginac/function.cppy b/ginac/function.cppy index ce38045f..dba9f4e0 100644 --- a/ginac/function.cppy +++ b/ginac/function.cppy @@ -7,7 +7,7 @@ * Please do not modify it directly, edit function.cppy instead! * function.py options: maxargs=@maxargs@ * - * GiNaC Copyright (C) 1999-2010 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2015 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -79,7 +79,7 @@ void function_options::initialize() set_name("unnamed_function", "\\\\mbox{unnamed}"); nparams = 0; eval_f = evalf_f = real_part_f = imag_part_f = conjugate_f = expand_f - = derivative_f = power_f = series_f = 0; + = derivative_f = expl_derivative_f = power_f = series_f = 0; info_f = 0; evalf_params_first = true; use_return_type = false; @@ -90,6 +90,7 @@ void function_options::initialize() imag_part_use_exvector_args = false; expand_use_exvector_args = false; derivative_use_exvector_args = false; + expl_derivative_use_exvector_args = false; power_use_exvector_args = false; series_use_exvector_args = false; print_use_exvector_args = false; @@ -630,10 +631,10 @@ ex function::derivative(const symbol & s) const { ex result; - if (serial == Order_SERIAL::serial) { - // Order Term function only differentiates the argument - return Order(seq[0].diff(s)); - } else { + try { + // Explicit derivation + result = expl_derivative(s); + } catch (...) { // Chain rule ex arg_diff; size_t num = seq.size(); @@ -752,6 +753,28 @@ ex function::pderivative(unsigned diff_param) const // partial differentiation throw(std::logic_error("function::pderivative(): no diff function defined")); } +ex function::expl_derivative(const symbol & s) const // explicit differentiation +{ + GINAC_ASSERT(serial