# How to make Matlab recognize that an expression rewritten by using subexpr() is equal to the original expression?

20 Ansichten (letzte 30 Tage)
Elif Cansu am 26 Mai 2024 um 9:57
Bearbeitet: Torsten am 26 Mai 2024 um 12:04
I would expect the isAlways() function below to return 1 but for some reason Matlab does not recognize that x=x_2. Is there a way to solve this problem?
syms a b c d e f x
x = a + (a+b+c+d+e)^(1/2) + c*(e+f+(a+b+c+d+e)^(1/2));
x_2 = subexpr(x)
sigma =
x_2 =
isAlways(x_2==x)
Warning: Unable to prove 'a + sigma + c*(e + f + sigma) == a + c*(e + f + (a + b + c + d + e)^(1/2)) + (a + b + c + d + e)^(1/2)'.
ans = logical
0
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

Torsten am 26 Mai 2024 um 12:03
Bearbeitet: Torsten am 26 Mai 2024 um 12:04
You have to resubstitute sigma by (a+b+c+d+e)^(1/2) in x_2 to compare with x:
syms a b c d e f x
x = a + (a+b+c+d+e)^(1/2) + c*(e+f+(a+b+c+d+e)^(1/2));
x_2 = subexpr(x)
sigma =
x_2 =
isAlways(subs(x_2)==x)
ans = logical
1
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Operators and Elementary Operations finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by