12
$\begingroup$

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?

$\endgroup$
2
  • 2
    $\begingroup$ extract from the notation tutorial : "When defining your own notations it is critically important to use the notation templates." $\endgroup$
    – andre314
    Commented Feb 18, 2013 at 2:29
  • $\begingroup$ user5463 I see that you have not Accepted answers to any of your questions. Please consider going through your questions and Accepting some answers. $\endgroup$
    – Mr.Wizard
    Commented Mar 3, 2013 at 13:30

1 Answer 1

20
$\begingroup$

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

$\endgroup$
8
  • $\begingroup$ Sorry, i cannot state the problem clearly in the comment window, so i move it to my question. $\endgroup$
    – novice
    Commented Feb 18, 2013 at 3:59
  • $\begingroup$ As I said in an earlier comment, that is where you should be providing the information from the outset. $\endgroup$ Commented Feb 18, 2013 at 4:05
  • $\begingroup$ Thanks, it works. But after symbolizing q1, how can i clear it? Subscript[q, 1] =. doesn't work. $\endgroup$
    – novice
    Commented Feb 18, 2013 at 4:59
  • 2
    $\begingroup$ 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. $\endgroup$ Commented Feb 18, 2013 at 5:13
  • $\begingroup$ I tried this: RemoveSymbolize[ParsedBoxWrapper[SubscriptBox["", ""]]] doesn't work. $\endgroup$
    – novice
    Commented Feb 18, 2013 at 7:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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