I am attempting to calculate the general form of an equation using symbolic math in the example below. This example, as shown, runs quickly and the result has already been very useful to me.

I am hoping to extend this example to the generalized case. If I allow one more parameter to be free, for example by removing a = 1, then calculating the expm never finishes. The problem goes from being solved in a few seconds to not completing within days.

Ideally I would like to allow all parameters to be free, including a, c, d, and f. Is there a trick that will make this exponentiation possible with additional free parameters? In other words, how can I remove a = 1 and still get the calculation to finish in reasonable time?