simplifying symbolic expressions using assumptions

조회 수: 5 (최근 30일)
Bhupi
Bhupi 2014년 8월 4일
답변: Christopher Creutzig 2014년 8월 29일
Hi all,
I have a symbolic equation as follows:
A = X / (XY + 1);
I know that for my specific case XY >> 1
I wish to simplify this equation using this assumption such that the denominator simplifies to 1 + XY ~ XY and A becomes X/XY = 1/Y.
Are there tools/functions in the symbolic math toolbox that allow one to do these user defined simplifications on a symbolic expression?
If not then is there a way I can do this through some code?
Thanks, Bhupi

채택된 답변

Yu Jiang
Yu Jiang 2014년 8월 4일
I don’t think there is a way to directly approximate a symbolic expression in MATLAB with another symbolic term.
However, here is a workaround for the example you provided. Since x*y >> 1, you may want to consider replace (x*y+1) with x*y by using the function sub (See Documentation) .
For example, the following code can be executed
>> syms x y
>> A = x/(x*y+1);
>> A = subs(A, 'x*y+1', 'x*y');
The result will be A = 1/y.
-Yu
  댓글 수: 1
Bhupi
Bhupi 2014년 8월 4일
Yu,
Thanks thats what I had in mind as an alternative but it gets a bit messy when I have too many of these substitutions.
I know MuCAD supports something like assume() where one can define assumptions to further simplify the expressions but it does not support something like A >> 1.
I wish MATLAB did have a much cleaner solution to this as many a times these symbolic equations get too lengthy and tedious and some heuristic/simplifications are required based on users knowledge of the system.
For now I guess I will go with your solution.
Thanks for your help.
-Bhupi

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Christopher Creutzig
Christopher Creutzig 2014년 8월 29일
This approximation can be viewed as a special kind of truncated series:
>> syms X Y
>> A = X/(X*Y + 1);
>> taylor(A, Y, Inf, 'Order', 2)
ans =
1/Y
>> taylor(A, X, Inf, 'Order', 2)
ans =
1/Y - 1/(X*Y^2)
>> taylor(A, X, Inf, 'Order', 1)
ans =
1/Y

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by