Very often symbolic computations are less easy than you want them to be, because the computer does not see one thing as simple versus another. It really does not care about any concepts of simplicity. Beauty and elegance are nothing to a computer.
expr = (A*exp(x) + B*exp(-x))/(C*exp(x) + D*exp(-x))
expr =
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1740051/image.png)
Now, what can you do? You can extract the numerator and denominator. Use numden.
[N,D] = numden(expr)
N = ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1740056/image.png)
D = ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1740061/image.png)
However, note that when I extracted the numerator and denominator, it actually gave me a different pair of expressions than I may have expected.
Even more amusing is that it may decide to do a simplify on the final result, and give you something you did not want. It can be frustrating.
expr2 = (N/exp(2*x))/(D/exp(2*x))
expr2 =
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1740066/image.png)
Yep. It can be stubborn. And it seems to prefer positive exponents. We can trick it a bit though, by doing this:
expr3 = simplify(N/exp(2*x))/simplify(D/exp(2*x))
expr3 =
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1740071/image.png)
Computers can sometimes be both amazingly smart and amazingly dumb.