Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to calculate the partial derivative?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128746] Re: How to calculate the partial derivative?
  • From: Tang Laoya <tanglaoya1989 at gmail.com>
  • Date: Fri, 23 Nov 2012 03:26:13 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <k8jss7$5nl$1@smc.vnet.net> <k8ks07$858$1@smc.vnet.net>

Dear Dr. Hanlon,

Thank you very much for your kindly reply. Your method works for me, that's great.

Now I have another question: 

I wish Mathematica give me an express which I can code by Fortran with smallest number of floating operations. For example, if I have:

bb1 = -Det[{{1, 1, 1}, {y2, y3, y4}, {z2, z3, z4}}];

the result by Mathematica is:
y3 z2 - y4 z2 - y2 z3 + y4 z3 + y2 z4 - y3 z4

I wish it output the result like this:
z2 (y3-y4) - z3 (y2-y4) + z4 (y2-y3)

What should I do?

Thanks,
Tang Laoya




On Thursday, November 22, 2012 5:43:45 PM UTC+8, Tang Laoya wrote:
> Dear all,
> 
> 
> 
> Sorry for my unsuitable example. My final program is as follows, could anyone please help me to take a look at it?
> 
> 
> 
> 
> 
> Thanks,
> 
> Tang Laoya
> 
> 
> 
> 
> 
> Clear["Global`*"];
> 
> L1 = (a1 + b1 x + c1 y + d1 z)/6/V;
> 
> L2 = (a2 + b2 x + c2 y + d2 z)/6/V;
> 
> L3 = (a3 + b3 x + c3 y + d3 z)/6/V;
> 
> L4 = (a4 + b4 x + c4 y + d4 z)/6/V;
> 
> 
> 
> nod = 10;
> 
> NN = Table[0, {nod}];
> 
> NN[[1]] = L1 (2 L1 - 1);
> 
> NN[[2]] = L2 (2 L2 - 1);
> 
> NN[[3]] = L3 (2 L3 - 1);
> 
> NN[[4]] = L4 (2 L4 - 1);
> 
> NN[[5]] = 4 L1 L2;
> 
> NN[[6]] = 4 L2 L3;
> 
> NN[[7]] = 4 L3 L1;
> 
> NN[[8]] = 4 L3 L4;
> 
> NN[[9]] = 4 L4 L1;
> 
> NN[[10]] = 4 L2 L4;
> 
> 
> 
> NNT = Flatten[Table[NN[[i]], {i, 1, nod}]];
> 
> Print["Dimensions of NNT:", Dimensions[NNT]];
> 
> 
> 
> DNx = D[NNT, x]
> 
> (* How to do to let the DNx have such express? For example, DNx[[1]] = b1/6/V*(2*L1-1) + L1*b1/3/V *)
> 
> 
> 
> DNy = D[NNT, y]
> 
> DNz = D[NNT, z]
> 
> DNxx = Transpose[{DNx}].{DNx};
> 
> DNyy = Transpose[{DNy}].{DNy};
> 
> DNzz = Transpose[{DNz}].{DNz};
> 
> Print["Dimensions of DNxx:", Dimensions[DNxx]];
> 
> 
> 
> K = DNxx + DNyy + DNzz;
> 
> 
> 
> (* I wish to replace all express "L1^aa*L2^bb*L3^cc*L4^dd" in matrix K by "aa!*bb!*cc!dd!/((aa+bb+cc+dd+3)!)*6*V", how to do? in the express, the aa, bb, cc or dd could be ZERO  *)
> 
> 
> 
> K = Expand[K];
> 
> Print["Simplifying K"];
> 
> K = Simplify[K]




  • Prev by Date: Plots combining
  • Next by Date: Re: How to calculate the partial derivative?
  • Previous by thread: Re: How to calculate the partial derivative?
  • Next by thread: Re: How to calculate the partial derivative?