Re: Three piece function

*To*: mathgroup at smc.vnet.net*Subject*: [mg60250] Re: Three piece function*From*: Paul Abbott <paul at physics.uwa.edu.au>*Date*: Thu, 8 Sep 2005 04:53:45 -0400 (EDT)*Organization*: The University of Western Australia*References*: <dfm7fi$h87$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

In article <dfm7fi$h87$1 at smc.vnet.net>, "Steven Jonak" <JonakSt at gw.kirkwood.k12.mo.us> wrote: > I'm a little new to using Mathematica for creating handouts/quizzes and > tests so please bear with me! I'm using Mathematica to write a test and > I can't seem to get a decent looking three-piece function. For two > pieces, the typesetting palette works fine. I used Show Expression to > see how they got the curly bracket on the left side but when I tried to > change it to three pieces with a curly bracket on the left side (a one > row, three column matrix with the bracket) the size of the bracket > doesn't change--and looks bad. By a three-piece function (sounds like a suit), I assume you mean a piecewise function? The Mathematica function Piecewise[] is built-in to handle this -- and has built-in typesetting rules. For example, f[x_] := Piecewise[{{x, x > 0}, {1, x == 0}, {-x, x < 0}}] is such a function, and HoldForm[f[x]] == f[x] // TraditionalForm gives you the formatted function. This is the easy way -- using Mathematica's typsetting to do the job for you. There is a way to change the size of a spanning bracket -- and this was covered by Neil Soiffer in the Tricks of the Trade column of The Mathematica Journal 8(1): Very large brackets and braces for their common uses in Mathematica (function call, lists) can look silly. Hence, as defined in UnicodeFontMapping.tr, they are set to grow to at most "2.01" (factor of two, with a fudge factor) times their normal size when SpanMaxSize is set to Automatic. Spanning can be controlled by selecting Expression Input | Spanning Characters | Expand Indefinitely from the Edit menu. Alternatively, if you use the Option Inspector and type in Span you will see the Spanning Character Options. You can set SpanMaxSize around the character, at the cell level, notebook level, or globally. You may not be happy with what the brackets and braces look like for function calls and lists, though. Here is the result of setting SpanMaxSize -> Infinity at the character level. There is another problem: in each case the opening bracket is displayed in color, indicating that it is unmatched. In TraditionalForm, a better alternative is to close off the unmatched left bracket with \[AutoRightMatch] (or \[EscapeKey]\right.\[EscapeKey]) which keeps things properly bracketed. This will not work for StandardForm unless you set DelimiterMatching->None for the cell (or any larger scope). Here is the result of closing off the unmatched left bracket. Cheers, Paul _______________________________________________________________________ Paul Abbott Phone: 61 8 6488 2734 School of Physics, M013 Fax: +61 8 6488 1014 The University of Western Australia (CRICOS Provider No 00126G) AUSTRALIA http://physics.uwa.edu.au/~paul