Student Support Forum: 'Collecting terms in an expression' topicStudent Support Forum > General > "Collecting terms in an expression"

 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic
 Author Comment/Response Bill Simpson 09/04/12 10:29pm In Response To 'Re: Re: Collecting terms in an expression'---------Unfortunately there are too many ... in your description for me to tell whether you want me to ... or want me to ... with ... and get ... If everyone would include a small notebook with their question that included just a large enough example so that readers could understand what was desired and so that the answer, whatever that might be, would almost certainly provide what was needed, and not have the notebook be so large and complicated that most readers would not bother trying to figure what the problem really was. Is this anything like what you are looking for? In[1]:= expr=Exp[a Fx[1]^2+a Fy[1]^2+a Fz[1]^2+b Fx[2]^2+b Fy[2]^2+b Fz[2]^2+c Fx[3]^2+c Fy[3]^2+c Fz[3]^2]; In[2]:= expr//.(_[n_]^2)..->f[n]^2 Out[2]= E^(3*a*f[1]^2 + 3*b*f[2]^2 + 3*c*f[3]^2) Note that ".." in that is a part of Mathematica pattern matching and is not my just substituting ... for things I don't bother to write. But this is more advanced pattern matching and not what someone would usually start with. If this isn't what you want then I suggest you include an example that has at least three of each kind of term and at least three different terms of that along with a carefully manually constructed example with no small errors that show exactly what the result should be. URL: ,

 Subject (listing for 'Collecting terms in an expression') Author Date Posted Collecting terms in an expression Sami 09/02/12 3:01pm Re: Collecting terms in an expression Bill Simpson 09/03/12 11:34pm Re: Re: Collecting terms in an expression Sami 09/04/12 12:48pm Re: Re: Re: Collecting terms in an expression Bill Simpson 09/04/12 10:29pm Re: Re: Re: Re: Collecting terms in an expression Sami 09/06/12 00:45am Re: Re: Re: Re: Re: Collecting terms in an expr... Bill Simpson 09/06/12 11:36am Re: Re: Re: Re: Collecting terms in an expression Sami 09/06/12 01:14am Re: Re: Re: Re: Re: Collecting terms in an expr... Bill Simpson 09/07/12 2:57pm Re: Re: Re: Re: Re: Re: Collecting terms in an ... Sami 09/08/12 03:26am Re: Re: Re: Re: Re: Re: Re: Collecting terms in... Sami 09/11/12 8:12pm Re: Re: Re: Re: Re: Re: Re: Re: Collecting term... Bill Simpson 09/14/12 03:31am
 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic