4
$\begingroup$

Beginners question. I am trying to get mathematica to format my Stirling number formulas using curly braces enter image description here instead of enter image description here (sorry for the images). This is just for display purposes so it does not have to be linked to StirlingS2. I have the same question for square brackets (for the stirling numbers of the first kind)

$\endgroup$
  • $\begingroup$ Please take a tour to learn how to express your appreciation via upvotes and an accept. $\endgroup$ – Kuba May 7 '17 at 20:07
4
$\begingroup$

Custom output-formatting is one way:

MakeBoxes[StirlingS2[n_, k_], StandardForm] := 
 RowBox[{
   "{", 
   GridBox[{{"n"}, {"k"}}, AutoDelete -> False, 
    GridBoxItemSize -> {"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}],
   "}"}]

StirlingS2[n, k]

Mathematica graphics

| improve this answer | |
$\endgroup$
2
$\begingroup$

The Notation package can work very well for this. I would suggest you read the documentation as it allows you to input your notation in a friendly and intuitive form, whose appearance does not survive cut and paste to this website. (Though it should work functionally)

Needs["Notation`"]

Notation[ParsedBoxWrapper[
RowBox[{"{", 
GridBox[{{"n_"}, {"k_"}}], "}"}]] \[DoubleLongLeftRightArrow] 
ParsedBoxWrapper[
RowBox[{"StirlingS2", "[", 
RowBox[{"n_", ",", "k_"}], "]"}]]]
| improve this answer | |
$\endgroup$
2
$\begingroup$

If for display only, another option is using Matex. Here are two versions, one for curly and one for solid braces.

<< MaTeX`
stirling1[n_,k_]:=MaTeX["{"<>ToString[n]<>"\\brace "<>ToString[k]<>"}",Magnification->2]
stirling2[n_,k_]:=MaTeX["{"<>ToString[n]<>"\\brack "<>ToString[k]<>"}",Magnification->2]

And now

stirling1[n,k]
stirling2[n,k]

Mathematica graphics

 Grid[Table[
  Row[{stirling1[n, k], stirling2[n, k]}], {n, 1, 5}, {k, 6, 10}], Frame -> All]

Mathematica graphics

| improve this answer | |
$\endgroup$
1
$\begingroup$

In:

Subscript[\[ScriptCapitalS], n] // Superscript[#, (\[ScriptK])] &
% // FullForm
{{n, k} // TableForm}
% // FullForm

Out:

enter image description here

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.