Azzera filtri
Azzera filtri

simplifying symbolic expressions using assumptions

8 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Yu Jiang
Yu Jiang il 4 Ago 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 Commento
Bhupi
Bhupi il 4 Ago 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

Accedi per commentare.

Più risposte (1)

Christopher Creutzig
Christopher Creutzig il 29 Ago 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

Categorie

Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by