Next: Algebra Tutorial Exercise 2, Previous: Types Tutorial Exercise 15, Up: Answers to Exercises [Contents][Index]

The result ‘`sqrt(x)^2`’ is simplified back to ‘`x`’ by the
Calculator, but ‘`sqrt(x^2)`’ is not. (Consider what happens
if ‘`x = -4`’.) If ‘`x`’ is real, this formula could be
simplified to ‘`abs(x)`’, but for general complex arguments even
that is not safe. (See Declarations, for a way to tell Calc
that ‘`x`’ is known to be real.)