Re: Mathematica question
- To: mathgroup at smc.vnet.net
- Subject: [mg85066] Re: Mathematica question
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Sun, 27 Jan 2008 05:40:29 -0500 (EST)
- Organization: University of Bergen
- References: <fnet0b$iaa$1@smc.vnet.net>
None None wrote: > Dear Sir > > I have a problem in mathematica. Consider the following function > definition. EC1[expr_]:=expr//.{m_ Log[a_]+m_Log[ b_]=A6 m (Log[a]+Log[ b]),m_ Log[a_]-m_Log[ b_]=A6 m (Log[a]-Log[ b])} > It works fine for "m Log[a]+mLog[b]", but it does not work for > "m Log[a]-m Log[b]". > Hi, Please convert the expression to InputForm (using ctrl+shift+i) before posting, otherwise special characters may get damaged during transfer. Also make sure that you post a plain text message (don't use the rich text editor of your webmail), and preserve the whitespace: mLog[b] and m Log[b] are different expressions. It seems to work fine for the specific examples you posted: In[1]:= EC1[expr_] := expr //. {m_ Log[a_] + m_ Log[b_] -> m (Log[a] + Log[b]), m_ Log[a_] - m_ Log[b_] -> m (Log[a] - Log[b])} In[2]:= EC1[m Log[a] + m Log[b]] Out[2]= m (Log[a] + Log[b]) In[3]:= EC1[m Log[a] - m Log[b]] Out[3]= m (Log[a] - Log[b]) Szabolcs