Dear Vladimir, On 01/02/2015 04:19 PM, Vladimir V. Kisil wrote:
Dear Richard,
On Wed, 31 Dec 2014 19:41:11 +0100, "Richard B. Kreckel" <kreckel@in.terlu.de> said:
RK> Your proposal is to have two ways to implement a function's RK> derivative: 1) by registering the existing derivative_func (pure RK> formal derivative) 2) or your new impl_derivative_func (smart RK> derivative, has to care about chain rule)
RK> I wonder if there is a way to make this more uniform. What do RK> you think?
Of course, the chain rule may be included as a particular case in the more general method. This will require a user slightly revise their custom function definitions for the new version of GiNaC. Do you consider this to be a reasonable price for a more straightforward code?
We shouldn't change the semantics of how the chain rule is applied to derivative_func because this would break existing code out there. And you're probably right that the not having to code the chain rule manually in most cases makes the code so much more straightforward that it's worth maintaining this more general case in the long run. I think this settles it: we should support both functions. In hindsight, what made your patch a little bit hard to understand to me may have been the function's naming _impl. What is the reason you named it like this? Isn't it applying the chain rule explicitly, rather than implicitly/automatically? Could we name it differently?
RK> derivatives, your patch has three (very minor) problems which RK> should be fixed before committing:
You are right. I may do this within a couple of weeks, I hope.
Thanks. -richard. -- Richard B. Kreckel <http://in.terlu.de/~kreckel/>