I came across the following way of defining complex conjugate in mathematica [a]:
SuperStar[y_] := y /. Complex[u_, v_] -> Complex[u, -v]
I am able to run this program, but I don't understand the way of defining it.
For example, let us define a function f as
f[x_] := x^2 + 1
Then I define (instead of *, I am using n):
f_^n := f /. t_ -> t + 1
Evaluating this results in following output:
"Tag Power in f_^n is Protected. "
However, for * in the superscript, it works fine.
I want to understand how they have defined the function? Does it use pattern matching? What is special with "*" in superscript position?
[a]: Patric Tam: A physicist guide's to mathematica