1
$\begingroup$

I want to reorganize a polynomial including exponents as the following Figure 1 to the form showing as Figure 2. Failed to realize it after several times trying such as Figure 3. Can you help me to get the result? Thank you.

Figure 1

enter image description here

Figure 2

enter image description here

or

enter image description here

Figure 3

enter image description here

Here are the codes:

In[12]:= Solve[-1 + d - d E^-az + f[z]/f0 == 0, f[z]]

Out[12]= {{f[z] -> -E^-az (-d - E^az + d E^az) f0}}

In[13]:= -E^-az (-d - E^az + d E^az) f0 // Simplify

Out[13]= f0 + d (-1 + E^-az) f0

In[14]:= FactorTerms[-E^-az (-d - E^az + d E^az) f0, f0]

Out[14]= f0 - d f0 + d E^-az f0

In[16]:= Factor[-E^-az (-d - E^az + d E^az) f0]

Out[16]= -E^-az (-d - E^az + d E^az) f0
$\endgroup$
1
  • 1
    $\begingroup$ Please post the Mathematica code,not the pictures. $\endgroup$
    – cvgmt
    Jul 9 at 8:12
2
$\begingroup$

Try Collect

Solve[-1 + d - d E^-az + f[z]/f0 == 0, f[z]] //Collect[#, {f0, Exp[z_]}] &
(*{{f[z] -> (1 - d + d E^-az) f0}}*)
$\endgroup$
2
  • 1
    $\begingroup$ Include Simplify to factor out d, i.e., Solve[-1 + d - d E^-az + f[z]/f0 == 0, f[z]][[1]] // Simplify // Collect[#, f0] & $\endgroup$
    – Bob Hanlon
    Jul 9 at 16:19
  • $\begingroup$ @Bob Hanlon, perfect solution, thank you. $\endgroup$
    – likehust
    Jul 11 at 6:51
1
$\begingroup$

Another way:

Solve[-1 + d - d E^-az + f[z]/f0 == 0, f[z]] // 
 Simplify[#,
  ComplexityFunction -> (LeafCount[#] +Count[#, _Symbol, Infinity]&)
  ]&
(*  {{f[z] -> (1 + d*(-1 + E^(-az)))*f0}}  *)
$\endgroup$
1
  • $\begingroup$ Thanks for you answer. $\endgroup$
    – likehust
    Jul 11 at 6:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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