Re: Bug??

*To*: mathgroup at smc.vnet.net*Subject*: [mg3845] Re: Bug??*From*: danl (Daniel Lichtblau)*Date*: Mon, 29 Apr 1996 00:32:51 -0400*Organization*: Wolfram Research, Inc.*Sender*: owner-wri-mathgroup at wolfram.com

In article <4l794q$1ov at ralph.vnet.net> pillay12 at shrike.und.ac.za (Theo Pillay) writes: > Hi all, > > I came across the following strange (and highly frustrating) behaviour while > using MMA to do some simple substitutions. The relevant parts of the text > file I was using are reproduced below. > > 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). This is worse than irritating - anybody know what's > happening here? > > I'm using Ver 2.0 for DOS. > > Thanks, > Theo > > It appears you are using a text (rather than notebook) interface. The problem is that the newline after F2 terminates a command, and so the next line of input, - D[B[x,y,y2],x] F3 + D[F2, {x,2}]; (* 1 *) is treated as a separate command. By moving the minus sign up a line you can avoid this. Another tactic is to begin with a left paren and end with a right paren. The parser will of course recognize when they are not yet balanced, and hence not terminate the command at an earlier point (see p. 61 of the ref manual). Daniel Lichtblau Wolfram Research, Inc. danl at wolfram.com ==== [MESSAGE SEPARATOR] ====