- #1

- 93

- 0

I would like to redefine the built-in square root function.

I have written this :

mySqrt[z_]:=√z;

Unprotect[Sqrt];

Sqrt[z_]:=If[Re[mySqrt[z]]+Im[mySqrt[z]]>0,mySqrt[z],-mySqrt[z]];

Protect[Sqrt]

This works fine and redefine Sqrt[] as I want it to be. But, the symbol √ (by typing Ctrl-2) still points to the original Sqrt[] function ! How can I redefine the behavior of the symbol √ ?

TIA :)