Borrar filtros
Borrar filtros

Reduce a certain kind of multiplication expression and square root expression

2 visualizaciones (últimos 30 días)
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 comentario
Walter Roberson
Walter Roberson el 29 de Abr. de 2011
You do not appear to have asked a question about MATLAB?
You have not indicated what problem you are observing?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by