Message Boards Message Boards

0
|
1651 Views
|
8 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Why does the command 'HoldForm' appear for the derivative of the 2nd function?

Posted 11 months ago

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.

Attachments:
POSTED BY: Vincent Renaud
8 Replies
Posted 11 months ago

To see string quotes in output cells you could use a simple stylesheet. Save the attached stylesheet to your PC. Then load it from an open notebook:

enter image description here

The stylesheet sets the option ShowStringCharacters to True for output cells. It is False by default.

Attachments:
POSTED BY: Hans Milton

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.

POSTED BY: Gianluca Gorni

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.

POSTED BY: Gianluca Gorni

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:

In[1]:= << Notation`
Symbolize[NotationTemplateTag[Subscript[r, 2]]]
ClearAll[r];
Subscript[r, 2] - Subscript[r, 2]

Out[4]= -Subscript[r, 2] + Subscript[r, 2]
Attachments:
POSTED BY: Gianluca Gorni
Posted 11 months ago

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

POSTED BY: Vincent Renaud

If you take

f[r, \[Theta]] // InputForm

you will see that there is a hidden HoldForm inside. How did you type the expression?

POSTED BY: Gianluca Gorni
Posted 11 months ago

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 !!!

POSTED BY: Vincent Renaud
Posted 11 months ago

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

HoldForm[expression] /. {r1 -> Subscript[r, 1], r2 -> Subscript[r , 2]}

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:
1) ensure that there are no hidden commands that can be copied without the user's knowledge
2) 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

POSTED BY: Vincent Renaud
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract