I’m aware of problems with subscripted symbols but in this example, the use of Symbolize fix the problem for the function ur. Then, with the function f (exactly the same definition as ur !) Mathematica returns HoldForm’[function f] after the solution. I don’t understand why both responses are different.
I realized now that Symbolize is very tricky indeed. If I type Subscript[r,2] literally, it will not get symbolized. In the following the subscript is typed once with ascii Subscript[r,2] and next with two-dimensional input:
So this is due to an unfortunate Copy-Paste, I don’t see any other explanation because, of course, I’ve never typed this.
Thank you very much for your answer : now I know the importance of //InputForm !!!
Wow, seeing this and the length of my analytical developments, I should use r1 and r2 instead of subscripted variables.
Thank you for this demonstration
Let’s tell the story from the beginning. I have several long expressions that I want to make more compact on the screen by replacing the variables r1 and r2 with
I then copied the result to the initial expression. At this point, I realized that the syntax highlighting did not change in the [r_, [Theta]_] functions: the variable r is colored green whether it is with a subscript or not. After some research, I see that the Symbolize function should be able to solve this problem. Finally, to check that my expressions are still correct, I use a formula with partial derivatives and this is where I discover an inconsistency due to a hidden HoldForm.
I don’t know if this can be considered a bug, but I think Wolfram could improve Mathematica by:
ensure that there are no hidden commands that can be copied without the user’s knowledge
if the variable Subscript[var, i] is defined as a symbol with Symbolyze, the syntax highlighting of var in Subscript[var, i] should no longer be active when this subscripted variable is used in a function
The FrontEnd interface can hide important information, specially in the output and in Traditional Form. The main example is that the output of strings hides the “” quotes in the output:
In[268]:= a - "a"
Out[268]= -"a" + a
Here the output in them front end looks identical to -a+a.
If I triple-click on the output of "a&b" to select what appears as a&b without quotes, and then paste it I get the quotes. If I double-click the ouput of "abc" to select, then copy and paste it, I do not get quotes (for that I need a triple-click). There is no visual indication of quotes: sometimes they get copied, sometimes not.
Thank you for alerting me to the ShowStringCharacters option. I have added to my personal style sheet. I still object to the design choice of setting it to False by default.
There remains the probem of the multiple-click (or extend selection) to select a string. When the string is not purely alphanumerical, as in "a b", double-click will select only part of the text, triple-click will select everything and the quotes. There seems to be no way to select only the content of the string, without the quotes. This is in contrast with what happens, for example, with {a, b}. Double-click will select the content without the brackets.
But maybe it is too late to change this basic editing behaviour.