I can't find a way in matlab to simplify this symbolic expression. x
will be evaluated in a real number.
syms x
expr = abs(x)^2
I expect the result to be
expr = x^2
Matlab gives
expr = abs(x)^2
Your desired solution is only valid if x
is real, thus you need to tell MATLAB that.
assume(x, 'real')
simplify(expr)