MathGroup Archive 1999

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

Search the Archive

Re: BracketingBar for output

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15826] Re: BracketingBar for output
  • From: phbrf at t-online.de (Peter Breitfeld)
  • Date: Fri, 12 Feb 1999 18:39:46 -0500 (EST)
  • Organization: das ist ein breites Feld ...
  • References: <79e86b$96l@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Peter Breitfeld <phbrf at t-online.de> schrieb:
> 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'. 

I want to thank all who gave me very helpful hints to solve this
problem.
I now use the following definitions:


Betrag=BracketingBar

BracketingBar[x_/;(VectorQ[x]&&(Or @@ Map[NumericQ,x]))]:=Sqrt[x.x]

this works really great:
Betrag[x] shows |x|
Betrag[{2,2,1}] shows 3
Betrag[{a,a,1}] shows Sqrt[1+2a^2]

and I can use the Output for Input, eg: |x|/.x->{1,2,2} shows 3

Thanks again to all!

es gruesst
      Peter
-- 
=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=
  Peter Breitfeld, Saulgau, Germany       (PGP public key: 08548045)


  • Prev by Date: Re: log plots
  • Next by Date: Re: FindMinimum
  • Previous by thread: Re: BracketingBar for output
  • Next by thread: Re: BracketingBar for output