Re: Bug??

*To*: mathgroup at smc.vnet.net*Subject*: [mg3809] Re: Bug??*From*: rhall2 at umbc.edu (hall robert)*Date*: Sat, 27 Apr 1996 00:55:50 -0400*Organization*: University of Maryland, Baltimore County*Sender*: owner-wri-mathgroup at wolfram.com

In article <4l794q$1ov at ralph.vnet.net>, Theo Pillay <pillay12 at shrike.und.ac.za> wrote: > >f[x,y] = a[x] y + b[x]; > >F1 = f[x,y]; > >F2 = y2 (D[f[x,y], y] - D[r[x], x]) + D[f[x,y],x]; > >F3 = r[x]; > >eight = -y2 A[x,y] D[F2,y] - 2 y2 B[x,y,y2] D[F3,y] + > 2 y2 D[F2,y,x] + y2^2 D[F2,{y,2}] - A[x,y] D[F2,x] + > B[x,y,y2] D[F2,y2] - > 2 B[x,y,y2] D[F3,x] - D[B[x,y,y2], y] F1 - D[B[x,y,y2], y2] F2 > - D[B[x,y,y2],x] F3 + D[F2, {x,2}]; (* 1 *) > >I get different answers for eight depending on the position of line (1). As >shown I get the wrong answer, but it works if I move (1) up to the previous >line (i.e next to F2). The difference in output is the term -2 B[x, y, y2] r'[x] which comes from -2 B[x,y,y2] D[F3,x] The problem is the derivative. If F3 isn't defined, then D[F3,x] = 0. Placing line 1 before the definition F3 = r[x] causes the entire term to evaluate to zero. This seems to be the result you want. If F3 is defined as the function r[x], then Mathematica treats it as it would any other symbolic function, and stores the result as r'[x]. F3 mates with x to survive. Call it marriageable. Differentiation kills the bachelor variable. -- Bob Hall | "Know thyself? Absurd direction! rhall2 at gl.umbc.edu | Bubbles bear no introspection." -Khushhal Khan Khatak ==== [MESSAGE SEPARATOR] ====