How can I set higher-order to1

9 ビュー (過去 30 日間)
Yanjun Wu
Yanjun Wu 2019 年 11 月 18 日
回答済み: Jyothis Gireesh 2019 年 11 月 21 日
For example, I have a function
f1=x^3*y^2*z+x^2*z+x^2*y*z^3;
let x^n=x,y^n=y,z^n=z,
so my function becomes
f1=x*y*z+x*z+x*y*z
=2x*y*z+x*z
Is there a built-in command to realize it?

回答 (1 件)

Jyothis Gireesh
Jyothis Gireesh 2019 年 11 月 21 日
There may not be an in-built function to replace all the higher order terms in a polynomial with their corresponding single order terms.
But, you may use the following workaround which makes use of symbolic substitution function subs()” to achieve the same result.
clear;
syms x y z f1(x,y,z);
f1(x,y,z) = x^3*y^2*z + x^2*z + x^2*y*z^3;
n = 3;
f2 = subs(f1(x,y,z),[x.^(2:n) y.^(2:n) z.^(2:n)],[repelem(x,n-1) repelem(y,n-1) repelem(z,n-1)]);
Here “n” is the highest power of all the variables in the polynomial.
Please refer to the following documentation which explains about simultaneously performing multiple substitutions in a symbolic function.
Hope this helps!!

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by