On 11/21/2012 12:15 AM, Tang Laoya wrote: > Dear all, > > I am trying to calculate the partial derivative by mathematica, I have the following commands: > L1=a1+b1*x+c1*y; > L2=a2+b2*x+c2*y; > L3=a3+b3*x+c3*y; > > NN=L1*L2; > > DNx=D[NN,x]; > > I got the following result: > DNex=b2 (a1+b1 x+c1 y)+b1 (a2+b2 x+c2 y) > > How to do to have the following result? > > DNex=b2*L1 + b1 * L2 >
The problem is that you did not use equations, but used expresions. Hence in your case L1 is now 'a1+b1*x+c1*y' and similarly with L2.
To do this right, I'd write things as equations, and use rules, like this: