0
$\begingroup$

I have the given expression which is a sum of exponential functions with some parameters $a,t,u,y$ where $a>0$.

Question Is it possible to ask Mathematica to order this expression in terms of descending absolute values of the arguments of the exponential functions? I mean I want that the first term in the desired expression to be the one in which the absolute value of the argument of the exponential function is the largest; then, the next term to be the one with the second largest absolute value of the exponential arguments.

exp = 3816 + 120u E^(2 a) - 1380 E^(4 a) - 50t E^(-(-5 + Sqrt[3]) a) - 
 300 E^((-1 + Sqrt[3]) a) - 1650 E^(2 (-1 + Sqrt[3]) a) + 
 360 E^(-(1 + Sqrt[3]) a) + 405 E^(2 (1 + Sqrt[3]) a) + 
 78 E^((-9 + Sqrt[3]) a) - 
 75 E^(-2 (-3 + Sqrt[3]) a) (-15 + 8y E^((-3 + Sqrt[3]) a))
$\endgroup$

1 Answer 1

3
$\begingroup$

Even if you reorder the expression, MMA will at once order it again according to its rules. Therefore, it is simplest to change the sum into a list of summands. However, toward this aim, you must fist expand all products.You may then use "SortBy" to get the searched for order.

exp0 = 3816 + 120 u E^(2 a) - 1380 E^(4 a) - 
  50 t E^(-(-5 + Sqrt[3]) a) - 300 E^((-1 + Sqrt[3]) a) - 
  1650 E^(2 (-1 + Sqrt[3]) a) + 360 E^(-(1 + Sqrt[3]) a) + 
  405 E^(2 (1 + Sqrt[3]) a) + 78 E^((-9 + Sqrt[3]) a) - 
  75 E^(-2 (-3 + Sqrt[3]) a) (-15 + 8 y E^((-3 + Sqrt[3]) a));

exp= List@@Expand@exp0;

Next we need a function that picks out the exponents:

pick= (# /. (_ : 1) Exp[a  x_] :>  N[x]) &;

With this we may no sort the list:

SortBy[exp,pick]

enter image description here

$\endgroup$

Your Answer

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

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