| 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: , |
|