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.

I have tried to create some Notation declarations as follows

<< Notation`
Notation[Subscript[x_, i_] \[DoubleLongLeftRightArrow] x[i]]
Notation[OverBar[x_] \[DoubleLongLeftRightArrow] mean[x]]

Mathematica9 throws the following errors for the declarations

Notation::noexbtag: The external representation Subscript[x_, y_] does not have an embedded TemplateBox with tag NotationTemplateTag. The Notation statement Notation[Subscript[x_, y_][DoubleLongLeftRightArrow]x[y]] may not have been entered using the palette, or the embedded TemplateBox may have been deleted. The embedded TemplateBox ensures correct parsing and retention of proper styling and grouping information. >>

and

Notation::noexbtag: The external representation Overscript[x_, ] does not have an embedded TemplateBox with tag NotationTemplateTag. The Notation statement Notation[Overscript[x, _][DoubleLongLeftRightArrow]mean[x]] may not have been entered using the palette, or the embedded TemplateBox may have been deleted. The embedded TemplateBox ensures correct parsing and retention of proper styling and grouping information. >>

respectively.

It is not really clear to me what is going on. I read the documentation for TemplateBox and looked up NotationTemplateTag which seems to have been replaced by ParsedBoxWrapper. After following some related function I thought the following might be what is required:

Notation[ToBoxes[Subscript[x_, y_]]\[DoubleLongLeftRightArrow] x[y]]
Notation[ToBoxes[OverBar[x_]] \[DoubleLongLeftRightArrow] mean[x]]

or perhaps

Notation[MakeBoxes[Subscript[x_, y_]]\[DoubleLongLeftRightArrow] x[y]]
Notation[MakeBoxes[OverBar[x_]] \[DoubleLongLeftRightArrow] mean[x]]

but both of those throw errors as well. So what is the right way to declare these notations? I am aware that setting up subscripts as a notation for function application is not something you would want to do in practice, but I am just experimenting.

Also do I actually need to import the Notation package or Notation buit-in with Mathematica9?

share|improve this question
    
Works for me. Are you using the palette to enter the notation (you must IIRC)? Also, pattern s/b on both sides. –  rasher Mar 30 at 21:58
    
If you've not already, take a look at the section Entering Notations (toward the bottom). Use of ParsedBoxWrapper is covered there for using Notation constructs without the palette. –  rasher Mar 31 at 1:00

1 Answer 1

up vote 1 down vote accepted
Notation[OverBar[x_] \[DoubleLongRightArrow] Mean[x_]]
z=Range[10];
OverBar[z]

(* 11/2 *)

n.b.: You cannot just copy/paste the above, per my comment.

share|improve this answer
    
Ok, that did work for me once I used the palette. One difference with what I tried before is that the second x in the Notation is also followed by an underscore in your code. What is the logic behind that? –  Daniel Mahler Mar 31 at 1:10
    
@DanielMahler: Covered in the doc. section I linked in the comment above - I'm not a Notation expert by any means, but I'm pretty certain an error is thrown if patterns used are not on both sides. Perhaps one of the resident experts will illuminate this, or the referred docs. might clarify. –  rasher Mar 31 at 1:18

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.