Properties of exponentials - symbolic algebra
5 次查看(过去 30 天)
显示 更早的评论
Hello all,
I am experiencing problems with the properties of exponentials, in particular when the exponent is a symbolic variable.
For example, if I set
syms x y
and I want to evaluate
exp(x)*exp(y)
is there a way of having the result the exponential with the sum of exponents
exp(x+y)
instead of the uncomfortable exp(x)*exp(y)?
Notice that it does work for one variable only, i.e. exp(x)*exp(x)=exp(2*x)
Thank you very much!
0 个评论
回答(3 个)
John D'Errico
2023-7-29
编辑:John D'Errico
2023-7-29
syms x y
V = exp(x)*exp(y)
simplify(V)
So simplify does work. On more complicated problems though, what seems simple to me may not seem simple to you, and to a computer, it may well be confused.
U = 6*exp(x) + 5*exp(-x)*exp(y) + 4*exp(-2*y)*exp(x)
simplify(U)
But simplify has some additional capabilities.
Usimp = simplify(U,'all',true,'steps',100)
And all of those options may be what you are looking to find. The first one is just the original expression.
Usimp(1)
But the second may be more in line with what you were hoping to see.
Usimp(2)
But maybe you might be looking for one of the others. How can simplify know? Maybe there is a common factor that can be removed?
Usimp(3)
And there are many other possibilities, all of which might be of interest. But a computer simply does not have the judgment to know what you personally think is most simple, especially for a complicated expression.
0 个评论
VBBV
2023-7-29
You can of course use simplify as @Mischa Kim mentioned. However, if you want to obtain the simplified expression as you wanted, you need to apply that function for those terms which involve mixed variables as shown below. This will simplify the overall expression ,
syms x y
p = 6*exp(x) + 5*exp(-x)*exp(y) + 4*exp(-2*y)*exp(x)
p = 6*exp(x) + simplify(5*exp(-x)*exp(y)) + simplify(4*exp(-2*y)*exp(x))
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Assumptions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!