フィルターのクリア

How can I define general properties of symbolic functions?

4 ビュー (過去 30 日間)
Jaime Abad Arredondo
Jaime Abad Arredondo 2021 年 1 月 19 日
I'm trying to work with undefined symbolic functions, but I want to take advantage of some of its properties. For instance, I know that my functions fulfill:
As such I tried the following:
syms x y xx yy f(x)
assume(f(x)*f(y)==f(x+y))
Z=f(x)*f(y);
K=f(yy)*f(xx);
simplify(Z)
simplify(K)
While Z returns f(x+y) (the set identity as expected), it doesn't work on K as I don't know how to set the assumption on generic variables. I would very much like to avoid setting the assumption on every pair of arguments of my model, any clue on how to do this?

採用された回答

Ananya Tewari
Ananya Tewari 2021 年 3 月 24 日
I understand that you want to set assumptions on generic variables. Currently it is not supported by MATLAB. A workaround if you do not wish to set assumption on every pair of argument, you can try using function handle to create a generic assume statement.
% creating function handle for assume statement
funAssume = @(a,b) assumeAlso(f(a)*f(b)==f(a+b)) % using assumeAlso to keep multiple assumptions
% calling funAssume() with any symbolic variable
funAssume(xx,yy)
K=f(yy)*f(xx);
simplify(K)
  1 件のコメント
Jaime Abad Arredondo
Jaime Abad Arredondo 2021 年 3 月 29 日
In the end I created a new class with objects that operated as I wanted. Much more laborious, but worked as intended. I accept the answer as it's a nice work-around. Still have to loop through every single variable combination calling the funAssume though...

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAssumptions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by