# How to reorganize a polynomial including exponents to the simplest form?

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 Figure 2 or Figure 3 Here are the codes:

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

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

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

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

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

Out= f0 - d f0 + d E^-az f0

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

Out= -E^-az (-d - E^az + d E^az) f0

• Please post the Mathematica code,not the pictures. Jul 9 at 8:12

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}}*)

• Include Simplify to factor out d, i.e., Solve[-1 + d - d E^-az + f[z]/f0 == 0, f[z]][] // Simplify // Collect[#, f0] & Jul 9 at 16:19
• @Bob Hanlon, perfect solution, thank you. Jul 11 at 6:51

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}}  *)

• Thanks for you answer. Jul 11 at 6:50