Is it possible to create a function which transforms one expression to another(by substitution)?

1 回表示 (過去 30 日間)
The function would accept an input like y >= 2x + 2 and return something like 4ab - a - b + 2 <= 0 by using the following substitutions:
x=2*a* b
y = a+b
The substitution equation is fixed(more complex than this example), and the function should work for every kind of functions in the expressions, like x^4 or sin(x) etc.

採用された回答

Steven Lord
Steven Lord 2019 年 7 月 23 日
Use Symbolic Math Toolbox. The subs function will be of use to you.
  1 件のコメント
Richárd Tóth
Richárd Tóth 2019 年 7 月 23 日
編集済み: Richárd Tóth 2019 年 7 月 23 日
thanks, is there a function for moving everything to left side too(or right side if its >=)? So the expression will have the form: 4ab - a - b + 2 <= 0 instead of a+b >= 4ab + 2
Never mind, I found the solution, I just need to subtract rhs(expression), expression = expression - rhs(expression),

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by