From: Francis W. <f.j...@qm...> - 2011-09-09 16:21:12
|
> From: Rainer Schöpf [mailto:rai...@gm...] > Sent: Thursday, September 08, 2011 9:21 PM > To: Francis Wright > Cc: red...@li... > Subject: RE: [Reduce-algebra-developers] An inconsistency in computing > derivatives? > > Some more border cases in differentiation: > > 1. This one has nothing to do with expanddf and the recent changes: > > depend cos(y),x; > > df(cos(y),x) => 0 > > because df(cos(y),x) simplifies to > > -sin(y) * df(y,x) > > and y doesn't depend on x. > > This looks wrong to me. Yes. But the only way that cos(y) can depend on x is if y depends on x, so I think REDUCE should either regard "depend cos(y),x; " as an error or interpret it to mean "depend y,x; ". But you can't do this for all functions, because an arbitrary function f(y) could reasonably have some implicit dependence on other variables. Off hand, the only way I can see to distinguish the cases would be to flag known operators in some way. > 2. With expand set to on: > > depend r,x; > df(f(r,cos(x)),x); > > gives > > df(f(r,cos(x)),r)*df(r,x) + df(f(r,cos(x)),cos(x))*df(cos(x),x) > > > I believe it is correct, but possibly not what one expects. Yes. I would suggest leaving this and waiting for users to complain if it's not what they expect. (I presume that df(cos(x),x) actually simplifies.) > BTW, I think there is an error in the procedure diffp, both in the original one and > the one in odesolve/odepatch.red: The else clause > > else if eqcar(cadr u, 'int) then > > is not an alternative to the then clause > > if cadr u eq v then > > (as the indentation suggests), but part of that then clause, ie there is a > > << > ... > >> > > missing. As far as odesolve/odepatch.red is concerned, I clearly missed this problem, partly because I try not to reformat existing code that I'm modifying. So can you change odesolve/odepatch.red as well, please, if you change the main code? Thanks, Francis |