MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: BracketingBar for output

  • To: mathgroup at
  • Subject: [mg15803] Re: [mg15717] BracketingBar for output
  • From: Jurgen Tischer <jtischer at>
  • Date: Sun, 7 Feb 1999 02:04:17 -0500 (EST)
  • Organization: Universidad del Valle
  • References: <>
  • Sender: owner-wri-mathgroup at




did work on my system. But this definition has the drawback that you
can't use the result afterwards, say in a situation like

Clear[x]; b = Betrag[x]



The answer in that case will be |x| instead of 5. A better way seems to
be to define 



Now if you ask for Betrag[x] with x not having a value it will return
|x|, but if later on x gets a numerical vector assigned, |x| will
evaluate to your Betrag.


PS: My spell checker offered bet rag for Betrag.

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'.
> To make it more clear (I hope :-)) I want the following behavior
> In[1]  Betrag[foo]
> Out[1] |foo|
> but
> In[1]  Betrag[{2,2,1}]
> Out[1] 3
> Is this possible?
> es gruesst
>       Peter
> --
> =--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=
>   Peter Breitfeld, Saulgau, Germany       (PGP public key: 08548045)

  • Prev by Date: Re: Surfacecoloring of a sphere
  • Next by Date: Re: Function definition
  • Previous by thread: BracketingBar for output
  • Next by thread: Re: BracketingBar for output