Reduce a certain kind of multiplication expression and square root expression

1 回表示 (過去 30 日間)
Kagome
Kagome 2011 年 4 月 29 日
Multiplication by a division expression. x * (y / z) can be better expressed as (x*y) / z. But before returning this new expression, reduce it by calling the reduce function on it. Reduce it after you create it but before you return it.
I have to make a function that can do this but can't seem to figure it out. So far I have this within a function:
elseif strcmp(Operand2{2}, 'Div')
reduce(Operand2);
Result = {'Num', Operand1{2} * Operand2{2}};
I also need a part of a function that can do this, "Radical is a power, and the exponentof that power is a number >= 2: Create a new 'Pow' expression using the same base but with an exponent that has had 2 subtracted from it. Reduce this expression and return it." So far I have this within a separate function.
if strcmp(radical{1},'Pow')
reduce(radical);
Result = reduce(sqrt(radical{2}));
  1 件のコメント
Walter Roberson
Walter Roberson 2011 年 4 月 29 日
You do not appear to have asked a question about MATLAB?
You have not indicated what problem you are observing?

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

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by