2
$\begingroup$

Assume that we have some complex algebraic expression, like

Exp[(a t + b s)/w] ( t Exp[ q t] w + q Exp[q s] Exp[-2 s] + a^2 Exp[3 s] + s t + 1 )

Now, this is just an example, the form of the expression is not very important. What is important is that we want to understand which is the exponential dependence on

Exp[s] and Exp[t]

by using some symbols, say es and et, as placeholders for Exp[s] and Exp[t].

In practice, I'd like to rearrange it to obtain (formally):

et^(a/w) es^(b/w) ( t et^q w + q es^(q-2) + a^2 es^3 + s t + 1 )

Note that I can not use the substitution /.{t -> Log[et]} because t and s also appear outside the exponential functions.

$\endgroup$

2 Answers 2

3
$\begingroup$
$Version

(* "12.3.1 for Mac OS X x86 (64-bit) (June 19, 2021)" *)

Clear["Global`*"]

expr = Exp[(a t + b s)/w] (t Exp[q t] w + q Exp[q s] Exp[-2 s] + 
     a^2 Exp[3 s] + s t + 1);

expr //. {Exp[c_. (a_. s + b_.)] :> es^(a*c)*Exp[b*c], 
  Exp[c_. (a_. t + b_.)] :> et^(a*c)*Exp[b*c]}

(* es^(b/w) et^(a/w) (1 + a^2 es^3 + es^(-2 + q) q + s t + et^q t w) *)

Note that the first factor is es^(b/w) NOT (as you showed) es^(a/w)

$\endgroup$
1
  • $\begingroup$ Thank you, I corrected the typo! $\endgroup$
    – Quillo
    Aug 4, 2021 at 17:32
3
$\begingroup$

Another workable solution that uses your idea of using Log:

expr /. Exp[a_] :> Simplify@Exp[Expand@a /. {t -> Log[et], s -> Log[es]}]

Wrap it up into a function where you specify the variables:

f[expr_, vars_List] := expr /. Exp[a_] :> Simplify@Exp[Expand@a /. Thread[vars -> Log[Symbol["e" <> ToString[#]] & /@ vars]]]

Then:

expr = Exp[(a t + b s)/w] ( t Exp[ q t] w + q Exp[q s] Exp[-2 s] + a^2 Exp[3 s] + s t + 1 );
f[expr, {s, t}]
(* es^(b/w) et^(a/w) (1 + a^2 es^3 + es^(-2 + q) q + s t + et^q t w) *)

Although, I prefer to index variables, so I would use

f[expr_, vars_List] := expr /. Exp[a_] :> Simplify@Exp[Expand@a /. Thread[vars -> Log[e /@ vars]]]

instead.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.