simplifying symbolic expressions using assumptions

5 vues (au cours des 30 derniers jours)
Bhupi
Bhupi le 4 Août 2014
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

Réponse acceptée

Yu Jiang
Yu Jiang le 4 Août 2014
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 commentaire
Bhupi
Bhupi le 4 Août 2014
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

Connectez-vous pour commenter.

Plus de réponses (1)

Christopher Creutzig
Christopher Creutzig le 29 Août 2014
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

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by