Effacer les filtres
Effacer les filtres

Reduce a certain kind of multiplication expression and square root expression

2 vues (au cours des 30 derniers jours)
Kagome
Kagome le 29 Avr 2011
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 commentaire
Walter Roberson
Walter Roberson le 29 Avr 2011
You do not appear to have asked a question about MATLAB?
You have not indicated what problem you are observing?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by