I would like to apply substitution rules to an object I have defined, but I must be doing something wrong. Here are the relevant pieces of code. First I have defined a function
Vec which is:
Vec[x_, y_String] := Subscript[Style[x, Italic, Bold], y]
Then I defined a function
Sprod which is:
Sprod[x_String, y_String] := Vec[q, x]\[CenterDot]Vec[q, y]
Now I would like to apply the following substitution rule, for example:
Sprod["1", "2"] /. Sprod[i_String, j_String] -> whatever
However, when I do that, nothing happens. Does anyone have an idea of why?
I have tried the explicit rule
Sprod["1", "2"] /. Sprod["1", "2"] -> whatever
which works just fine. However, I'd like to write something a bit more general.