Re: BracketingBar for output

*To*: mathgroup at smc.vnet.net*Subject*: [mg15812] Re: BracketingBar for output*From*: Paul Abbott <paul at physics.uwa.edu.au>*Date*: Mon, 8 Feb 1999 03:25:39 -0500 (EST)*Organization*: University of Western Australia*References*: <79e86b$96l@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Peter Breitfeld wrote: > In my "personal package" I have the function Betrag[x_]:=Sqrt[x.x] > > Now I want that in cases where this function can't be evaluated, the > output in StandardForm is displayes as |x|. (left and right > BracketingBar, these symbols you get when entering `ESC l| ESC' and > `ESC r| ESC'. Actually, to indicate such a norm I would use DoubleBracketingBar instead of BracketingBar: In[1]:= DoubleBracketingBar[(x_)?VectorQ]:= Sqrt[x . x] In[2]:= DoubleBracketingBar[{a,b,c}] Out[2]= 2 2 2 Sqrt[a + b + c ] Then there is no need to define Betrag. Here are these input lines in TraditionalForm -- which is much more readable: Notebook[{ Cell[BoxData[ \(TraditionalForm \`\[LeftDoubleBracketingBar]x_?VectorQ\[RightDoubleBracketingBar] := \ at \(x . x\)\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm \`\[LeftDoubleBracketingBar]{a, b, c}\[RightDoubleBracketingBar]\)], "Input"], Cell[BoxData[ \(TraditionalForm\`\ at \(a\^2 + b\^2 + c\^2\)\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm \`\[LeftDoubleBracketingBar]x\[RightDoubleBracketingBar]\)], "Input"], Cell[BoxData[ \(TraditionalForm \`\[LeftDoubleBracketingBar]x\[RightDoubleBracketingBar]\)], "Output"] }, Open ]] } ] Cheers, Paul ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul at physics.uwa.edu.au AUSTRALIA http://www.physics.uwa.edu.au/~paul God IS a weakly left-handed dice player ____________________________________________________________________