# How is it possible to prevent separation of negative and positive exponents when symbolic simplifying?

As parts of my computations, I use InverseLaplaceTransform for some symbolic expressions. As an example, when I have the following transformation for sum of two similar expressions:

InverseLaplaceTransform[(b  E^-(b x)^n (b x)^(-1 + n))/ s + (b (b x)^(-1 + n))/s, s, t]


then, Mathematica simplifies and converts it into a form which the negative numeric exponent is separated from the symbolic part of exponent and is brought into the denominator as:

(E^-(b x)^n (1 + E^(b x)^n) (b x)^n)/x


and this becomes a challenge in next step, once evaluating the expression for some values of the parameters at x=0, which has become now the root of the denominator. I think this is not really related to the InverseLaplaceTransform, since similar results could also appear when using Simplify, for example, the following simplification:

Simplify[b (b x)^(-1 + n), n>1]


would also result in:

(b x)^n/x


Regarding that simplifying is necessary in my computations, is there a way to prevent only this type of simplification? I was thinking of using some options similar to those used in HoldForm, but I don’t know if it is possible and how to do it.

• I am not sure how to change the simplification. May be special rules are needed. But if I were you, I would just make separate function that handles x=0 case? Something like this r[x_]=InverseLaplaceTransform[(b E^-(b x)^n (b x)^(-1+n))/s+(b (b x)^(-1+n))/s,s,t]; r[x_/;x==0]:=0 (*or what ever*) now you can safetly do r[x] and it will not break. If x=0 then it will use the safe function, else it will use the main function.This is another way to do exception handling by making a function to handle the exceptions. – Nasser Feb 28 '18 at 5:58
• Generally, it’s a good idea, but as I said, this was a part of my computations I briefly presented here. I am also using other functions including successive differentiating as well in an iteration process, and just at the end of the iterations, I might evaluate the result at values assigned to the parameters. So, I could not hold the transformations uncalculated until this step to use the modification you proposed. @Naser – Hossein Feb 28 '18 at 6:51

Restricting the appearance of $x^{-1}$ with ComplexityFunction option in FullSimplify helps here:

invlapl = InverseLaplaceTransform[(b E^-(b x)^n (b x)^(-1 + n))/
s + (b (b x)^(-1 + n))/s, s, t];
f[e_] := LeafCount[e] + 100*Boole[ ! FreeQ[e, x^(-1)]]
FullSimplify[invlapl, ComplexityFunction -> f]


gives

$$b e^{-(b x)^n} \left(e^{(b x)^n}+1\right) (b x)^{n-1}.$$

Try the following simple approach. Here is your expression:

expr1 = (E^-(b x)^n (1 + E^(b x)^n) (b x)^n)/x


The way to remove x from the denominator and include it into the expression in the numerator is to apply PowerExpand:

expr2 = MapAt[PowerExpand, expr1, 4]

(*  b^n E^-(b x)^n (1 + E^(b x)^n) x^(-1 + n)  *)


However, if you want to protect some combination (say, (b x)^(-1 + n)) from further changes you may, of course use a command from the Hold group, but there is also a more simple and convenient way. You may simply rename this combination. For example, here I give it the name c:

 expr3 = expr2 /. x^(-1 + n) -> c/b^(-1 + n)

(*  b c E^-(b x)^n (1 + E^(b x)^n) *)


Now you may do any transformation you need, and AFTER that replace c back: c -> b^(-1 + n) x^(-1 + n).

Have fun!

• @Alexei although your proposition is very efficient and I really appreciate that, but it is still general, since the real position of x in my computations is not always 4 when using MapAt. Also, I wonder why PowerExpand is not merely adequate supposed that I don’t mind preserving other combination (as you considered), just like the following: PowerExpand[1/x E^(-b^n x^n) (x^n - 2 b x^n)] (* (E^(-b^n x^n) (x^n - 2 b x^n))/x *) while even using MapAt returns the same result: MapAt[PowerExpand, 1/x E^(-b^n x^n) (x^n - 2 b x^n), {{}}] – Hossein Feb 28 '18 at 12:25
• Please, note that since I have a long and complicated expression which is obtained through successive transformations and differentiation, it would not be easy for me to predict the exact form of the final expression, so I had to provide some very short parts of my computations in order to be able to discuss more convenient. – Hossein Feb 28 '18 at 12:28
• @ Hossein I think that if you want to transform it, you need to each time feed MapAt with the tree coordinate of the expression to which you need to apply PowerExpand. Otherwise it does not work. – Alexei Boulbitch Mar 5 '18 at 9:45