Re: Hold and Simplify
- To: mathgroup at smc.vnet.net
- Subject: [mg77233] Re: Hold and Simplify
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Wed, 6 Jun 2007 06:47:19 -0400 (EDT)
- Organization: Uni Leipzig
- References: <f43ds0$hu$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi,
a) Simplify[] will simplify the expression and HoldForm[Exp[a]*Exp[b]]
is not simpler than Exp[a+b]
b)
f[Exp[a__Plus]] := (HoldForm @@ {Exp /@ somefunction @@ a}) /.
somefunction -> Times
will expand the sum of multiple exponents into products
and
Exp[a + b]*Sin[Exp[-a + c]] + a + g*Exp[d - e] /.
Exp[a_Plus] :> f[Exp[a]]
will do it for the expression with Exp[] somewhere.
Regards
Jens
news.inode.at wrote:
> Hi,
>
>
>
> I would like to change Exponential functions of sums to products of
>
> exponential functions. From reading postings from the year 2004 I tried
>
> the following:
>
>
>
> f[Exp[x_ + y_]] := Exp[x + y] /. Exp[a_ + b_] :> HoldForm[Exp[x]*Exp[y]];
>
>
>
> Simplify[Exp[a + b], TransformationFunctions -> f]
>
>
>
> Unfortunately this gave me
>
> Exp[a+b]
>
>
>
> I had more luck with
>
>
>
> rule = {Exp[a_ + b_] -> f[Exp[a + b]]}
>
>
>
> ReplaceRepeated[Exp[a + b], rule]
>
>
>
> which gave me Exp[a]Exp[b]
>
>
>
> Trying
>
>
>
>
>
> ReplaceRepeated[Exp[a + b + c], rule]
>
> gave me:
>
> Exp[a]Exp[b+c]
>
>
>
> Why doesn't the TransformationFunction trick work? Why does
>
> ReplacedRepeated stop?
>
>
>
>
>
> My ultimate goal would be the following: (I need to transfer large
>
> formulae into C code and would like to avoid use of exponential function
>
> as much as possible)
>
>
>
> myreplacelist={Exp[var1]->expvar1, Exp[var2]->expvar2}
>
> myformula=Exp[2 var1 - 3 var2 + a * Exp[var1]];
>
>
>
> ultimate rule applied to my formula gives:
>
>
>
> expvar1 * expvar1 / (expvar2 * expvar2 * expvar2) * Exp[a expvar1]
>
>
>
> Thanks for your time!
>
>
>
> best,
>
>
>
> Paul
>
>
>
>
>
>
>