       Re: newbie: how to define, typeset a multi-rule function?

• To: mathgroup at smc.vnet.net
• Subject: [mg96813] Re: newbie: how to define, typeset a multi-rule function?
• From: Tom Roche <tlroche at gmail.com>
• Date: Wed, 25 Feb 2009 04:06:19 -0500 (EST)
• References: <go0j63\$n28\$1@smc.vnet.net>

```Tom Roche Feb 24, 5:46 am (rearranged)
>> I'm trying to create a notebook that typesets a particular
>> mathematical function, and then solves it.

I.e. I'll have a line of text that shows the function to solve, then
another line of input that solves it when evaluated. Like a homework
problem.

>> The function has 2 parts or rules: it returns k (a constant) for one
>> part of its domain, and 0 otherwise. This is typically typeset with
>> the function name and the equals sign on one line, then a large left
>> curly bracket (or brace) centered on that line, then each rule on a
>> separate line with all the rule lines to the right of the bracket.

>> I suspect in this case I just need to know what the appropriate
>> term is for what I'm trying to create. However I've tried searching
>> the docs for various permutations of multi-rule or multi-line
>> function, and even googling, to no avail.

dh Tue, Feb 24, 2009 at 7:20 AM
> there is "Piecewise".

doh! That's the term I was trying to remember.

Indeed, and I can solve that like

part1ex1fn = {Piecewise[{{k \[Chi], 0 <= \[Chi] <= 1}}, 0]}
Solve[
First[
Integrate[part1ex1fn, {\[Chi], -\[Infinity], \[Infinity]}]
] == 1, k
]

(though I assume there's a better way). But how to layout the equation
as text?

>> For an example in a math layout, I can almost typeset the function
>> in OpenOffice Math like f_x(%chi) = left lbrace stack {k if %chi in
>> [0,1] # 0 otherwise} right rbrace (except that I don't want the
>> closing brace, but that's another problem). I tried to create this
>> using the palettes, but I didn't see one that did multiline
>> brackets.

DrMajorBob Tue, Feb 24, 2009 at 10:45 AM
> As you're not speaking "Mathematica",

I'm trying. Ya gotta learn somehow.

> perhaps this is the function you want:

> Subscript[f, x][chi_] = Piecewise[{{k, 0 <= chi <= 1}}]

Yep, that sure looks like it, but ...

> I used the "special characters" palette to enter \[Chi].

... where's the palette item to get the left brace?

> You can also copy/paste the [line above] to Mathematica, press Enter
> to evaluate the line, and the bracketed version should appear.

That it does, but it doesn't show the f_x(\[Chi]); i.e. the right-hand
side appears, but not the LHS. How do I get both the LHS and RHS to
appear as text?

TIA, Tom Roche <Tom_Roche at pobox.com>

```

• Prev by Date: Re: newbie: programmatic sequence of plots?
• Next by Date: Graphics export for high quality documents
• Previous by thread: Re: newbie: how to define, typeset a multi-rule function?
• Next by thread: Re: newbie: how to define, typeset a multi-rule function?