Tricky Symbolizations with the Notation Package
- To: mathgroup at smc.vnet.net
- Subject: [mg19341] Tricky Symbolizations with the Notation Package
- From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
- Date: Fri, 20 Aug 1999 23:09:28 -0400
- Sender: owner-wri-mathgroup at wolfram.com
The notebook below includes code for a slight modification of code Jason Harris posted to the MathGroup. This code will ensure (i) with an integer subscript is treated as a symbol, but (i) with any other subscript it isn't a symbol. The Version 4 Help Browser explains how one can use complex patterns with the Symbolize button. In that documentation it says one should use a button labeled "Insert Pattern Wrapper" to make the button a looks like: Symbolize[i sub(n_?UnparsedIntegerQ)] Where is this button? It's in the Full Notation Palette under "Wrapper Boxes". However, it seems the button doesn't work as advertised. The only way I can find to make this cell is to manually type the cryptic cell expression or edit the cell expression from a similar cell that Jason sent to the MathGroup. Is the button called "Insert Pattern Wrapper" in Version 4 for Windows-9x broken (my version)? What is the easy way to make the cell I am having trouble with? -------------------- Regards, Ted Ersek For Mathematica tips, tricks see http://www.dot.net.au/~elisha/ersek/Tricks.html (*****************************************) (***** Start of Notebook Expression ******) Notebook[{ Cell[BoxData[ \(<< Utilities`Notation`\)], "Input"], Cell[BoxData[{ RowBox[{\(UnparsedIntegerQ[\ boxes___] := \ \[IndentingNewLine]ReleaseHold[\ \ \[IndentingNewLine]Hold[ IntegerQ]\ @\ \[IndentingNewLine]\(Hold[ Unevaluated]\ @\[IndentingNewLine]ToExpression[boxes, StandardForm, Hold]\)\[IndentingNewLine]]\), "\[IndentingNewLine]", " "}], "\n", RowBox[{ RowBox[{"Symbolize", "[", TagBox[ SubscriptBox["i", TagBox[\(n_?UnparsedIntegerQ\), NotationPatternTag, TagStyle->"NotationPatternWrapperStyle"]], NotationBoxTag, TagStyle->"NotationTemplateStyle"], "]"}], "\[IndentingNewLine]", " "}], "\n", \(i\_\(n_?IntegerQ\) := ToExpression\ @\ MakeBoxes[\ i\_n]\)}], "Input"], Cell["\<\ After evaluating the cell above (i) with an integer subscript is an symbol, \ while (i) with any other subscript is a subscript expression.\ \>", "Text", Hyphenation->False], Cell[CellGroupData[{ Cell[BoxData[ \(Head /@ {i\_2, i\_a, i\_1.2, i\_\[Pi], i\_\(2/3\)}\)], "Input"], Cell[BoxData[ \({Symbol, Subscript, Subscript, Subscript, Subscript}\)], "Output"] }, Open ]], Cell[TextData[{ "Jason indicated this requires the use of one or two advanced features of \ the Notation pallete. It seems ducumentation for the needed features can be \ found in ", ButtonBox["Notation:Definition:NotationPatternTag", ButtonStyle->"AddOnsLink"], " under Add-ons in the Help Browser. What is the easy way to create the \ cell below?" }], "Text", Hyphenation->False], Cell[BoxData[ RowBox[{"Symbolize", "[", TagBox[ SubscriptBox["i", TagBox[\(n_?UnparsedIntegerQ\), NotationPatternTag, TagStyle->"NotationPatternWrapperStyle"]], NotationBoxTag, TagStyle->"NotationTemplateStyle"], "]"}]], "Input"] } ]