1
$\begingroup$

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?

$\endgroup$
2
  • $\begingroup$ Works for me. Are you using the palette to enter the notation (you must IIRC)? Also, pattern s/b on both sides. $\endgroup$
    – ciao
    Mar 30, 2014 at 21:58
  • $\begingroup$ 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. $\endgroup$
    – ciao
    Mar 31, 2014 at 1:00

1 Answer 1

1
$\begingroup$
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.

$\endgroup$
2
  • $\begingroup$ 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? $\endgroup$ Mar 31, 2014 at 1:10
  • $\begingroup$ @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. $\endgroup$
    – ciao
    Mar 31, 2014 at 1:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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