Determining Whether Symbolic Polynomials Are Linear

4 ビュー (過去 30 日間)
Ian Orzel
Ian Orzel 2022 年 4 月 26 日
編集済み: Torsten 2022 年 4 月 26 日
Suppose that, using Matlab's syms expression, I generate a polynomial using a set of symbolic variables. Here is an example of such a polynomial that I could generate:
syms x y z
f = x*y + z + y*z;
Next, I want some function that will take in such a polynomial as well as a subset of symbolic variables that I designate as free. Then, this function will return whether this polynomial is linear in terms of the given subset of variables, treating all other variables as constants. I would like to find a native Matlab function that accomplishes this without having to code one from scratch myself. Let us suppose that such a function can be denoted as "is_linear". Now, I will proceed to show examples of its use on the above polynomial:
is_linear(f, [y z]) % Returns false
is_linear(f, [y]) % Returns true
I was wondering if anyone knew of a native Matlab function that would accomplish this for me or make the process of creating such a function much simpler. Thank you for reading, and I look forward to seeing responses.

回答 (1 件)

Torsten
Torsten 2022 年 4 月 26 日
編集済み: Torsten 2022 年 4 月 26 日
You will have to check the two properties of a linear function:
f(x+y) = f(x) + f(y)
f(a*x) = a*f(x)
for symbolic variables x,y and a.

カテゴリ

Help Center および File ExchangeSystems of Nonlinear Equations についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by