Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

When I'm using Symbolize function, there are some details that I'm not sure. For example:

<< Notation`
Symbolize[Subscript[q, 1],Subscript[q, 2]];(*I want to declare two symbols with subscript*)
  1. Can I type the name "Symbolize[...]" instead of using the Notation Palette?It seems there is a little distinction, Notation Palette has a colored region:

    enter image description here

  2. Does "Symbolize" support multiple inputs, such as the above example? What if i want to declare as many as 100 variables with subscript?

I want to do differentiation on q1.

Subscript[q, 1] /:D[Subscript[q, 1], t, NonConstants -> {Subscript[q, 1]}] := 
Subscript[dq, 1];
D[Subscript[q, 1]^2, t]

I expect to get 2*q1*dq1, but Mathematica gives 0. Why is that?

share|improve this question
2  
extract from the notation tutorial : "When defining your own notations it is critically important to use the notation templates." –  andre Feb 18 '13 at 2:29
    
user5463 I see that you have not Accepted answers to any of your questions. Please consider going through your questions and Accepting some answers. –  Mr.Wizard Mar 3 '13 at 13:30

1 Answer 1

up vote 8 down vote accepted

You cannot simply type Symbolize[...] which you should probably know from an error message you should be getting. For example what you have in your question gives:

Symbolize[Subscript[q, 1],Subscript[q, 2]]

enter image description here

To see why you get this message you can use show expression to see what is being pasted via the palette:

enter image description here

From this we can see that Symbolize makes use of TemplateBoxes so the easiest way to get the correct coding is to use the palette.

For the other part of your question you probably should have found that you got an error when you entered a sequence of multiple inputs, so the answer is, no, it does not support multiple inputs. The objective is to take an expression and have it treated as a symbol.

Note that you can use patterns so rather than

Symbolize[Subscript[q, 1],Subscript[q, 2]];

which will cause an error, you can enter

Symbolize[ParsedBoxWrapper[SubscriptBox["q", "_"]]]

...which unfortunately doesn't display ideally in this formatting when you cut and paste so here is the screen grab

enter image description here

The first pic shows me entering q and a subscript box then in the next pic I have entered an underscore in the subscript box. So now any q with a subscript (Subscript[q, 1] and Subscript[q, 2] etc.) are treated as symbols.


Edit #1

If you want to symbolize all subscripts then use this pattern:

Symbolize[ParsedBoxWrapper[SubscriptBox["_", "_"]]]

In the screen grab below you can see that changed interpretation once all subscripts are treated as symbols:

enter image description here


...ok final edit

I expect to get 2*q1*dq1, but Mathematica gives 0. Why is that?

enter image description here

If you get something different I assume it is a typing error or a problem with your version on your platform. For this answer I have been using 8.0.4 on mac 10.6.8


This really is the final edit

enter image description here

share|improve this answer
    
Sorry, i cannot state the problem clearly in the comment window, so i move it to my question. –  novice Feb 18 '13 at 3:59
    
As I said in an earlier comment, that is where you should be providing the information from the outset. –  Mike Honeychurch Feb 18 '13 at 4:05
    
Thanks, it works. But after symbolizing q1, how can i clear it? Subscript[q, 1] =. doesn't work. –  novice Feb 18 '13 at 4:59
2  
Read the documentation for the Notations package and then ask your question if you continue to have problems. Methods to clear notations and remove symbolize are discussed in the docs. –  Mike Honeychurch Feb 18 '13 at 5:13
    
I tried this: RemoveSymbolize[ParsedBoxWrapper[SubscriptBox["", ""]]] doesn't work. –  novice Feb 18 '13 at 7:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.