Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Collecting terms in an expression' topicStudent Support Forum > General > Archives > "Collecting terms in an expression"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Bill Simpson
09/03/12 11:34pm

I don't believe what you showed and what you want are equal.

In[1]:= Exp[4]+Exp[7]==Exp[4+7]
Out[1]= False

In[2]:= Exp[4]+Exp[7]//N
Out[2]= 1151.23

In[3]:= Exp[4+7]//N
Out[3]= 59874.1

Did you perhaps mean multiply instead of add???

In[4]:= Exp[4]*Exp[7]==Exp[4+7]
Out[4]= True

That automatically simplifies to what you asked for.

In[5]:= Exp[x[1]^2]*Exp[y[1]^2]*Exp[z[1]^2]*Exp[x[n]^2]*Exp[y[n]^2]*Exp[z[n]^2]

Out[5]= Exp[x[1]^2+x[n]^2+y[1]^2+y[n]^2+z[1]^2+z[n]^2]

But if you really want what you asked for then

In[6]:= Exp[Exp[x[1]^2]+Exp[y[1]^2]+Exp[z[1]^2]+Exp[x[n]^2]+Exp[y[n]^2]+Exp[z[n]^2]//.Exp[u_]->u]

Out[6]= Exp[x[1]^2+x[n]^2+y[1]^2+y[n]^2+z[1]^2+z[n]^2]

I knew how to do that based on LOTS of study and practice with Mathematica patterns. Look at FullForm[yourexpression] to see what it is without Mathematica trying to hide behind the gui interface. Then experiment with patterns that match the structure of what you see in that FullForm output. With that hint and enough study and practice and failure and patience you too can start to get the hang of patterns in Mathematica

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