Re: Collect coefficients of array variables during calculation:

*To*: mathgroup at smc.vnet.net*Subject*: [mg87035] Re: [mg86971] Collect coefficients of array variables during calculation:*From*: Sseziwa Mukasa <mukasa at jeol.com>*Date*: Sat, 29 Mar 2008 04:26:06 -0500 (EST)*References*: <200803280812.DAA04512@smc.vnet.net>

On Mar 28, 2008, at 4:12 AM, Gopinath Venkatesan wrote: > Hello Mathematica Friends > > If we have an array variable, and assuming after intermediate > calculations, some equations are found to be below. > > eqn1=10. A[[1,1]]+b A[[1,1]]+c A[[1,2]]+3. A[[1,2]] (only for > illustration) > > Simplify[] does not combine the coefficients under same array > member, i.e. instead of (10.+b)A[[1,1]]+(c+3.)A[[1,2]], it is > showing the earlier mentioned form. > > Is there a way to collect them and simplify them. But when I > checked for simple cases, Simplify[] seems to work. Try this: Simplify[10. A[[1, 1]] + b A[[1, 1]] + c A[[1, 2]] + 3. A[[1, 2]] /. A[[i__]] -> A[i]] /. A[i__] -> A[[i]] Regards, Sseziwa Mukasa

**References**:**Collect coefficients of array variables during calculation:***From:*Gopinath Venkatesan <gopinathv@ou.edu>