フィルターのクリア

Removing exponents from a sysm class term

1 回表示 (過去 30 日間)
ross montgomery
ross montgomery 2012 年 10 月 30 日
I am interested in removing the exponents from a syms class object. For instance, i wish the following expression,
answer = x^2 + y^2*z^2
to instead take the form of,
answer = x + y*z
I was wondering if there was a shorter way to do this other than writing my own muPad procedure.
Thanks in advance.
Ross Montgomery

採用された回答

Alexander
Alexander 2012 年 10 月 31 日
You can use evalin to do a substitution of the powers inside MuPAD:
>> evalin(symengine, ['subs(', char(answer) ,', hold(_power) = (x->x), EvalChanges)'])
ans =
x + y*z
  1 件のコメント
ross montgomery
ross montgomery 2012 年 10 月 31 日
Hi Alexander,
This worked great and is exaclty what i was looking for.
Many thanks.
Ross

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 10 月 30 日
You might be able to do something using MuPad's map() and match(); http://www.mathworks.com/help/symbolic/mupad_ref/match.html
Side note: Extended Symbolic Math Toolbox only applied to the Maple-based Symbolic Toolbox which predated the MuPAD based Symbolic Math Toolbox.
  1 件のコメント
ross montgomery
ross montgomery 2012 年 10 月 31 日
Thanks for your response Walter and i'll stop tagging "Extended Symbolic Math Toolbox" on all of these problems.
Thanks again.
Ross

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

カテゴリ

Help Center および File ExchangeUtilities for the Solver についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by