Re: Collect coefficients of array variables during calculation:
- To: mathgroup at smc.vnet.net
- Subject: [mg87015] Re: Collect coefficients of array variables during calculation:
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Sat, 29 Mar 2008 04:22:18 -0500 (EST)
- Organization: University of Bergen
- References: <fsib0m$5qe$1@smc.vnet.net>
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. > > Thanks for the suggestions. A[[1,1]] evaluates to something if A is a compound expression. If A is not a compound expression, then it is not correct to write A[[1,1]], and Mathematica will print an error message. So A[[1,1]] can never appear in the result of a successful calculation.