Common factor

17 ビュー (過去 30 日間)
cyberdyne
cyberdyne 2011 年 9 月 29 日
コメント済み: Steven Lord 2024 年 4 月 22 日
Is there a function to make it find a common factor in an expression with symbolic variables?
For example:
ab+ac--(matlab command)--->a(b+c)
Thanks

回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2011 年 9 月 29 日
help factor
syms a b c
factor(a*c + b*c)
  6 件のコメント
Zoya Saevna
Zoya Saevna 2021 年 2 月 3 日
You shouldn't be kidding!
Steven Lord
Steven Lord 2024 年 4 月 22 日
I know this part of the discussion is kind of old, but that error message cyberdyne quoted is likely to occur if for example the user were to store the output of the call to the factor function to a variable named factor in the Command Window. [Though it appears the text of the error message may have changed in the decade+ since the original message.]
syms a b c
f = a*b+a*c
f = 
factor = factor(f) % This first call works
factor = 
z = factor(f) % This second one does not, since factor is now a variable
Error using indexing (line 918)
Invalid MATLAB indexing or symbolic function definition. Symbolic function arguments must be symbolic variables and function body must be convertible to sym expression.

Error in indexing (line 962)
R_tilde = builtin('subsref',L_tilde,Idx);

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

カテゴリ

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