Re: exporting a list of functions for use in a C function
- To: mathgroup at smc.vnet.net
- Subject: [mg44441] Re: exporting a list of functions for use in a C function
- From: Tom Burton <tburton at brahea.com>
- Date: Sun, 9 Nov 2003 06:01:28 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
As recommended by others, you should use CForm. I've appended to this
message a function that I use to make minor alterations in the output of
CForm, such as Power -> pow, to yield a more standard form in C++. I hope it
helps.
Tom Burton
On 11/5/03 6:17 AM, in article bob7qo$qu1$1 at smc.vnet.net, "Nathan Moore"
<nmoore at physics.umn.edu> wrote:
> I've composed a large list of functions in Mathematica that I'd like to
> have a c function evaluate. To my knowledge c and C++ reject the
> convention x^2 and prefer either x*x or pow(x,2).
Notebook[{
Cell[CellGroupData[{
Cell["CppForm: Making CForm more like typical C++", "Subsection"],
Cell[CellGroupData[{
Cell["Usage", "Subsubsection"],
Cell[BoxData[
\(\(CppForm::usage = "\<CppForm[expression,options] \
\[LongRightArrow] C++ form of expression with conventions applied for \
AutoSEA. Use options--e.g., {\[Omega]->omega}--to make additional \
substitutions. Alternate form: CppForm[funcName,variable,options] \
\[LongRightArrow] CppForm of the expression rhs in the list of \
occurences of \"variable=rhs\" in the function(s) funcName.\>";\)\)], \
"Input",
InitializationCell->True],
Cell[BoxData[
\(\(CppForm::mult = "\<Function `1` contains `3` definitions of \
`2`, perhaps owing to initialization or because `1` is itself \
overloaded. The following list contains all definitions.\>";\)\)], \
"Input",
InitializationCell->True]
}, Closed]],
Cell[CellGroupData[{
Cell["Code", "Subsubsection"],
Cell["\<\
v. 051 (9/9/97) Improved treatment of divisors
v. 064 (6/6/98) Added desubscripting and integer conversion
v. 064 (6/10/98) Commented out integer conversion. Hangs sometimes.\
\
\>", "Text"],
Cell[BoxData[
\(CppForm[expr_, opts___?OptionQ] :=
Module[{\[IndentingNewLine]x,
rename =
Flatten[{opts}], \n\t\t\tfloat1 = {Power[x_,
i_Integer] \[RuleDelayed] Power[x, ToString@i],
Rational[i_Integer, j_Integer] \[RuleDelayed]
Rational[ToString@i, ToString@j],
Subscript[x_, i_Integer] \[RuleDelayed]
Subscript[x, ToString@i]},
float2 =
head_[a___, i_Integer, b___] \[RuleDelayed]
head[a, 1. i, b],
float3 = {s_String \[RuleDelayed] ToExpression[s],
Times[1. , x__] :> Times[x],
Times[\(-1. \), x__] :>
Times[\(-x\)]}, \n\t\t\tdesubscript = {X_\_s_ \
\[RuleDelayed] Symbol[ToString[X] <> ToString[s]],
X_\_s__ \[RuleDelayed]
Symbol[
ToString[X] <>
StringJoin @@ \(ToString /@ {s}\)]}, \
\[IndentingNewLine]zeroBasedIndex = {\[IndentingNewLine]HoldPattern[
sym_\[LeftDoubleBracket]1\[RightDoubleBracket]] \
\[RuleDelayed] HoldForm[
sym\[LeftDoubleBracket]0\[RightDoubleBracket]], \
\[IndentingNewLine]HoldPattern[
sym_\[LeftDoubleBracket]2\[RightDoubleBracket]] \
\[RuleDelayed] HoldForm[
sym\[LeftDoubleBracket]1\[RightDoubleBracket]], \
\[IndentingNewLine]HoldPattern[
sym_\[LeftDoubleBracket]3\[RightDoubleBracket]] \
\[RuleDelayed] HoldForm[
sym\[LeftDoubleBracket]2\[RightDoubleBracket]], \
\[IndentingNewLine]HoldPattern[
sym_\[LeftDoubleBracket]4\[RightDoubleBracket]] \
\[RuleDelayed] HoldForm[
sym\[LeftDoubleBracket]3\[RightDoubleBracket]], \
\[IndentingNewLine]HoldPattern[
sym_\[LeftDoubleBracket]5\[RightDoubleBracket]] \
\[RuleDelayed] HoldForm[
sym\[LeftDoubleBracket]4\[RightDoubleBracket]], \
\[IndentingNewLine]HoldPattern[
sym_\[LeftDoubleBracket]6\[RightDoubleBracket]] \
\[RuleDelayed] HoldForm[
sym\[LeftDoubleBracket]5\[RightDoubleBracket]], \
\[IndentingNewLine]HoldPattern[
sym_\[LeftDoubleBracket]7\[RightDoubleBracket]] \
\[RuleDelayed] HoldForm[
sym\[LeftDoubleBracket]6\[RightDoubleBracket]], \
\[IndentingNewLine]HoldPattern[
sym_\[LeftDoubleBracket]8\[RightDoubleBracket]] \
\[RuleDelayed] HoldForm[
sym\[LeftDoubleBracket]7\[RightDoubleBracket]], \
\[IndentingNewLine]HoldPattern[
sym_\[LeftDoubleBracket]9\[RightDoubleBracket]] \
\[RuleDelayed] HoldForm[
sym\[LeftDoubleBracket]8\[RightDoubleBracket]], \
\[IndentingNewLine]HoldPattern[
sym_\[LeftDoubleBracket]10\[RightDoubleBracket]] \
\[RuleDelayed] HoldForm[
sym\[LeftDoubleBracket]9\[RightDoubleBracket]], \
\[IndentingNewLine]HoldPattern[
sym_\[LeftDoubleBracket]11\[RightDoubleBracket]] \
\[RuleDelayed] HoldForm[
sym\[LeftDoubleBracket]10\[RightDoubleBracket]],
HoldPattern[
sym_\[LeftDoubleBracket]i_\[RightDoubleBracket]] \
\[RuleDelayed] HoldForm[
sym\[LeftDoubleBracket]i -
1\[RightDoubleBracket]]}, \n\t\t\tfunctions1 = \
{\n\t\t\t\t\tSqrt[x_] \[RuleDelayed]
sqrt[x], \n\t\t\t\t\tSin[x_] \[RuleDelayed]
sin[x], \n\t\t\t\t\tCos[x_] \[RuleDelayed]
cos[x], \n\t\t\t\t\tTan[x_] \[RuleDelayed]
tan[x], \n\t\t\t\t\tSec[x_] \[RuleDelayed]
sec[x], \n\t\t\t\t\tCsc[x_] \[RuleDelayed]
cosec[x], \n\t\t\t\t\tCot[x_] \[RuleDelayed]
cot[x], \n\t\t\t\t\tSinh[x_] \[RuleDelayed]
sinh[x], \n\t\t\t\t\tCosh[x_] \[RuleDelayed]
cosh[x], \n\t\t\t\t\tTanh[x_] \[RuleDelayed]
tanh[x], \n\t\t\t\t\tPower[x_, 2] \[RuleDelayed]
sqr[x], \n\t\t\t\t\tPower[x_, 3] \[RuleDelayed]
cube[x], \n\t\t\t\t\tPower[x_,
0.5 | 1/2] \[RuleDelayed]
sqrt[x], \[IndentingNewLine]Power[E,
x_] \[RuleDelayed]
exp[x], \n\t\t\t\t\tPower[x_, n_] \[RuleDelayed]
Pow[x,
n]\n\t\t\t\t\t}, \n\t\t\tfunctions2 = {\n\t\t\t\t\t\
y_\ Pow[x_, \(-0.5\) | \(-1\)/2] \[RuleDelayed]
Unevaluated[y/sqrt[x]], \n\t\t\t\t\tPow[
x_, \(-0.5\) | \(-1\)/2] \[RuleDelayed]
Unevaluated[
1/sqrt[x]], \n\t\t\t\t\ty_\ Pow[
x_, \(-2\)] \[RuleDelayed]
Unevaluated[y/sqr[x]], \n\t\t\t\t\tPow[
x_, \(-2\)] \[RuleDelayed]
Unevaluated[
1/sqr[x]], \n\t\t\t\t\ty_\ Pow[
x_, \(-3\)] \[RuleDelayed]
Unevaluated[y/cube[x]], \n\t\t\t\t\tPow[
x_, \(-3\)] \[RuleDelayed]
Unevaluated[
1/cube[x]], \n\t\t\t\t\ty_\ Pow[
x_, \(-1\)] \[RuleDelayed]
Unevaluated[y/x], \n\t\t\t\t\tPow[
x_, \(-1\)] \[RuleDelayed]
Unevaluated[
1/x]\n\t\t\t\t}\[IndentingNewLine]}, \n\t\t\
\(\(\(\(expr /. rename\) /.
desubscript\) (*\(\(\(//.\)\(float1\)\) //.
float2\) //. float3*) //. functions1\) //.
functions2\) /. zeroBasedIndex //
CForm\n\t]\)], "Input",
InitializationCell->True],
Cell["\<\
v. 051 (9/6/97) Return a list of two or more; return a \
single expression if just one\
\>", "Text"],
Cell[BoxData[
\(CppForm[func_, var_, opts___?OptionQ] := \n\t
Replace[\n\t\tMap[
CppForm[#, opts] &, \n\t\t\tCases[DownValues[func],
HoldPattern[var = rhs_] \[Rule] HoldForm@rhs,
Infinity]], \n\t\t{HoldPattern[{single_}] \[RuleDelayed]
Unevaluated@
single, \n\t\tHoldPattern[{multiple__}] \[RuleDelayed] \
\((Message[CppForm::mult, HoldForm[func], HoldForm[var],
Length[{multiple}]];
Unevaluated[{multiple}])\)}]\)], "Input",
InitializationCell->True],
Cell[BoxData[
\(SetAttributes[CppForm, HoldAll]\)], "Input",
InitializationCell->True]
}, Open ]],
Cell[CellGroupData[{
Cell["Local tests", "Subsubsection"],
Cell[BoxData[
\(Clear[f, g, s, x, a, b]\)], "Input"],
Cell[CellGroupData[{
Cell[BoxData[
\(CppForm[
a^2 b\^\(1/2\) + b\^ .5 + a\ b^3\ + \
Sqrt[4 a + b^4 - a^3]\ Sin[a\ b]/\((Cos[a]\ Tan[b])\) +
1/x + 1/x^2 + 1/x^3 - 1/Sqrt[x] - x^\(-\((1/2)\)\) +
x^0.5]\)], "Input"],
Cell["\<\
1/x + a*cube(b) + 1/cube(x) + 1/sqr(x) +
sqrt(b) + sqr(a)*sqrt(b) - 2/sqrt(x) +
sqrt(x) + cot(b)*sec(a)*sin(a*b)*
sqrt(4*a - cube(a) + Pow(b,4))\
\>", "Output"]
}, Open ]],
Cell[BoxData[
\(f[r] :=
Module[{x}, {x = a,
x = a^2 b\^\(1/2\) + b\^ .5 + a\ b^3\ + \
Sqrt[4 a + b^4 - a^3]\ Sin[a\ b]/Cos[a]\ Tan[b] +
1/x + 1/x^2 + 1/x^3 - 1/Sqrt[x] - x^\(-\((1/2)\)\) +
x^0.5}]\)], "Input"],
Cell[BoxData[
\(f[s] :=
Module[{x}, {y = b,
x = a^2 b\^\(1/2\) + b\^ .5 + a\ b^3\ + \
Sqrt[4 a + b^4 - a^3]\ Sin[a\ b]/Cos[a]\ Tan[b] +
1/x + 1/x^2 + 1/x^3 - 1/Sqrt[x] - x^\(-\((1/2)\)\) +
x^0.5}]\)], "Input"],
Cell[BoxData[
\(g[s] :=
Module[{x}, {y = a,
x = a^2 b\^\(1/2\) + b\^ .5 + a\ b^3\ + \
Sqrt[4 a + b^4 - a^3]\ Sin[a\ b]/Cos[a]\ Tan[b] +
1/x + 1/x^2 + 1/x^3 - 1/Sqrt[x] - x^\(-\((1/2)\)\) +
x^0.5}]\)], "Input"],
Cell[CellGroupData[{
Cell[BoxData[
\(CppForm[f, y]\)], "Input"],
Cell["b", "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
\(CppForm[g, y]\)], "Input"],
Cell["a", "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
\(CppForm[f, x]\)], "Input"],
Cell[BoxData[
FormBox[
RowBox[{\(CppForm::"mult"\), \(\(:\)\(\ \)\), "\<\"Function \\!\
\\(TraditionalForm\\`f\\) contains \\!\\(TraditionalForm\\`3\\) \
definitions of \\!\\(TraditionalForm\\`x\\), perhaps owing to \
initialization or because \\!\\(TraditionalForm\\`f\\) is itself \
overloaded. The following list contains all definitions.\"\>"}],
TraditionalForm]], "Message"],
Cell[BoxData[
FormBox[
RowBox[{"{",
RowBox[{
InterpretationBox[
StyleBox["a",
ShowStringCharacters->True,
NumberMarks->True],
CForm[
HoldForm[ a]],
Editable->True,
AutoDelete->True], ",",
InterpretationBox[
StyleBox[\(\(sqr(a)\)*\(Pow(b, 0.5)\)\ + \ sqrt(b)\ + \
a*\(cube(b)\)\ + \ \(Sqrt(
4*a\ + \ Pow(b, 4)\ - \ cube(a))\)*\(sin(a*b)\)/
cos \((a)\)*\(tan(b)\)\ + \ 1/x\ + \
1/sqr \((x)\)\ + \ 1/cube \((x)\)\ - \
1/Sqrt \((x)\)\ - \ Pow(x, \(-0.5\))\ + \ sqrt(x)\),
ShowStringCharacters->True,
NumberMarks->True],
CForm[
HoldForm[
Plus[
Times[
sqr[ a],
Pow[ b,
Times[ 1,
Power[ 2, -1]]]],
sqrt[ b],
Times[ a,
cube[ b]],
Times[
Sqrt[
Plus[
Times[ 4, a],
Pow[ b, 4],
Times[ -1,
cube[ a]]]],
Times[
sin[
Times[ a, b]],
Power[
cos[ a], -1]],
tan[ b]],
Times[ 1,
Power[ x, -1]],
Times[ 1,
Power[
sqr[ x], -1]],
Times[ 1,
Power[
cube[ x], -1]],
Times[ -1,
Times[ 1,
Power[
Sqrt[ x], -1]]],
Times[ -1,
Pow[ x,
Times[ -1,
Times[ 1,
Power[ 2, -1]]]]],
sqrt[ x]]]],
Editable->True,
AutoDelete->True], ",",
InterpretationBox[
StyleBox[\(\(sqr(a)\)*\(Pow(b, 0.5)\)\ + \ sqrt(b)\ + \
a*\(cube(b)\)\ + \ \(Sqrt(
4*a\ + \ Pow(b, 4)\ - \ cube(a))\)*\(sin(a*b)\)/
cos \((a)\)*\(tan(b)\)\ + \ 1/x\ + \
1/sqr \((x)\)\ + \ 1/cube \((x)\)\ - \
1/Sqrt \((x)\)\ - \ Pow(x, \(-0.5\))\ + \ sqrt(x)\),
ShowStringCharacters->True,
NumberMarks->True],
CForm[
HoldForm[
Plus[
Times[
sqr[ a],
Pow[ b,
Times[ 1,
Power[ 2, -1]]]],
sqrt[ b],
Times[ a,
cube[ b]],
Times[
Sqrt[
Plus[
Times[ 4, a],
Pow[ b, 4],
Times[ -1,
cube[ a]]]],
Times[
sin[
Times[ a, b]],
Power[
cos[ a], -1]],
tan[ b]],
Times[ 1,
Power[ x, -1]],
Times[ 1,
Power[
sqr[ x], -1]],
Times[ 1,
Power[
cube[ x], -1]],
Times[ -1,
Times[ 1,
Power[
Sqrt[ x], -1]]],
Times[ -1,
Pow[ x,
Times[ -1,
Times[ 1,
Power[ 2, -1]]]]],
sqrt[ x]]]],
Editable->True,
AutoDelete->True]}], "}"}], TraditionalForm]], "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
\(CppForm[g, x]\)], "Input"],
Cell["\<\
sqr(a)*Pow(b,0.5) + sqrt(b) + a*cube(b) +
Sqrt(4*a + Pow(b,4) - cube(a))*
sin(a*b)/cos(a)*tan(b) + 1/x +
1/sqr(x) + 1/cube(x) - 1/Sqrt(x) -
Pow(x,-0.5) + sqrt(x)\
\>", "Output"]
}, Open ]],
Cell[BoxData[
\(Clear[f, g, s, x, a, b]\)], "Input"]
}, Closed]]
}, Open ]]
},
FrontEndVersion->"5.0 for Macintosh",
ScreenRectangle->{{43, 1152}, {0, 746}},
AutoGeneratedPackage->Automatic,
WindowToolbars->{},
WindowSize->{688, 720},
WindowMargins->{{199, Automatic}, {Automatic, 0}},
PrintingCopies->1,
PrintingPageRange->{Automatic, Automatic},
PageHeaders->{{Cell[
TextData[ {
CounterBox[ "Page"]}], "PageNumber"], Inherited, Cell[
TextData[ {
ValueBox[ "FileName"]}], "Header"]}, {Cell[
TextData[ {
ValueBox[ "FileName"]}], "Header"], Inherited, Cell[
TextData[ {
CounterBox[ "Page"]}], "PageNumber"]}},
PageFooters->{{
Inherited, Inherited, Inherited}, {
Cell[ "Vibro-Acoustic Sciences", "Footer"], Inherited, Cell[
TextData[ {
ValueBox[ "Date"], "\n",
ValueBox[ "Time"]}], "Footer"]}},
PageFooterLines->{Inherited, True},
PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}},
CellElementSpacings->{"ClosedCellHeight"->0},
ShowCellLabel->True,
RenderingOptions->{"ObjectDithering"->True,
"RasterDithering"->False},
StyleDefinitions -> Notebook[{
Cell[CellGroupData[{
Cell["Style Definitions", "Subtitle"],
Cell["\<\
Modify the definitions below to change the default \
appearance of all cells in a given style. Make modifications to any \
definition using commands in the Format menu.\
\>", "Text"],
Cell[CellGroupData[{
Cell["Style Environment Names", "Section"],
Cell[StyleData[All, "Working"],
PageWidth->WindowWidth,
ScriptMinSize->9],
Cell[StyleData[All, "Presentation"],
PageWidth->WindowWidth,
ScriptMinSize->12,
FontSize->16],
Cell[StyleData[All, "Condensed"],
PageWidth->WindowWidth,
CellBracketOptions->{"Margins"->{1, 1},
"Widths"->{0, 5}},
ScriptMinSize->8,
FontSize->11],
Cell[StyleData[All, "Printout"],
PageWidth->PaperWidth,
ScriptMinSize->5,
FontSize->10,
PrivateFontOptions->{"FontType"->"Outline"}]
}, Closed]],
Cell[CellGroupData[{
Cell["Notebook Options", "Section"],
Cell["\<\
The options defined for the style below will be used at \
the Notebook level.\
\>", "Text"],
Cell[StyleData["Notebook"],
PageHeaders->{{Cell[
TextData[ {
CounterBox[ "Page"]}], "PageNumber"], None, Cell[
TextData[ {
ValueBox[ "FileName"]}], "Header"]}, {Cell[
TextData[ {
ValueBox[ "FileName"]}], "Header"], None, Cell[
TextData[ {
CounterBox[ "Page"]}], "PageNumber"]}},
CellFrameLabelMargins->6,
StyleMenuListing->None]
}, Closed]],
Cell[CellGroupData[{
Cell["Styles for Headings", "Section"],
Cell[CellGroupData[{
Cell[StyleData["Title"],
CellMargins->{{12, Inherited}, {20, 40}},
CellGroupingRules->{"TitleGrouping", 0},
PageBreakBelow->False,
CounterIncrements->"Title",
CounterAssignments->{{"Section", 0}, {"Equation", 0}, {
"Figure", 0}, {"Subtitle", 0}, {"Subsubtitle", 0}},
FontFamily->"Helvetica",
FontSize->36,
FontWeight->"Bold"],
Cell[StyleData["Title", "Presentation"],
CellMargins->{{24, 10}, {20, 40}},
LineSpacing->{1, 0},
FontSize->44],
Cell[StyleData["Title", "Condensed"],
CellMargins->{{8, 10}, {4, 8}},
FontSize->20],
Cell[StyleData["Title", "Printout"],
CellMargins->{{2, 10}, {12, 30}},
FontSize->24]
}, Closed]],
Cell[CellGroupData[{
Cell[StyleData["Subtitle"],
CellMargins->{{12, Inherited}, {20, 15}},
CellGroupingRules->{"TitleGrouping", 10},
PageBreakBelow->False,
CounterIncrements->"Subtitle",
CounterAssignments->{{"Section", 0}, {"Equation", 0}, {
"Figure", 0}, {"Subsubtitle", 0}},
FontFamily->"Helvetica",
FontSize->24],
Cell[StyleData["Subtitle", "Presentation"],
CellMargins->{{24, 10}, {20, 20}},
LineSpacing->{1, 0},
FontSize->36],
Cell[StyleData["Subtitle", "Condensed"],
CellMargins->{{8, 10}, {4, 4}},
FontSize->14],
Cell[StyleData["Subtitle", "Printout"],
CellMargins->{{2, 10}, {12, 8}},
FontSize->18]
}, Closed]],
Cell[CellGroupData[{
Cell[StyleData["Subsubtitle"],
ShowGroupOpenCloseIcon->True,
CellMargins->{{12, Inherited}, {20, 15}},
CellGroupingRules->{"TitleGrouping", 20},
PageBreakBelow->False,
CounterIncrements->"Subsubtitle",
CounterAssignments->{{"Section", 0}, {"Equation", 0}, {
"Figure", 0}},
FontFamily->"Helvetica",
FontSize->14,
FontSlant->"Italic"],
Cell[StyleData["Subsubtitle", "Presentation"],
CellMargins->{{24, 10}, {20, 20}},
LineSpacing->{1, 0},
FontSize->24],
Cell[StyleData["Subsubtitle", "Condensed"],
CellMargins->{{8, 10}, {8, 8}},
FontSize->12],
Cell[StyleData["Subsubtitle", "Printout"],
CellMargins->{{2, 10}, {12, 8}},
FontSize->14]
}, Closed]],
Cell[CellGroupData[{
Cell[StyleData["Section"],
CellDingbat->"\[FilledSquare]",
ShowGroupOpenCloseIcon->True,
CellMargins->{{25, Inherited}, {8, 24}},
CellGroupingRules->{"SectionGrouping", 30},
PageBreakBelow->False,
CounterIncrements->"Section",
CounterAssignments->{{"Subsection", 0}, {"Subsubsection", 0}},
FontFamily->"Helvetica",
FontSize->16,
FontWeight->"Bold"],
Cell[StyleData["Section", "Presentation"],
CellMargins->{{40, 10}, {11, 32}},
LineSpacing->{1, 0},
FontSize->24],
Cell[StyleData["Section", "Condensed"],
CellMargins->{{18, Inherited}, {6, 12}},
FontSize->12],
Cell[StyleData["Section", "Printout"],
CellMargins->{{13, 0}, {7, 22}},
FontSize->14]
}, Closed]],
Cell[CellGroupData[{
Cell[StyleData["Subsection"],
CellDingbat->"\[FilledSmallSquare]",
ShowGroupOpenCloseIcon->True,
CellMargins->{{22, Inherited}, {8, 20}},
CellGroupingRules->{"SectionGrouping", 40},
PageBreakBelow->False,
CounterIncrements->"Subsection",
CounterAssignments->{{"Subsubsection", 0}},
FontSize->14,
FontWeight->"Bold"],
Cell[StyleData["Subsection", "Presentation"],
CellMargins->{{36, 10}, {11, 32}},
LineSpacing->{1, 0},
FontSize->22],
Cell[StyleData["Subsection", "Condensed"],
CellMargins->{{16, Inherited}, {6, 12}},
FontSize->12],
Cell[StyleData["Subsection", "Printout"],
CellMargins->{{9, 0}, {7, 22}},
FontSize->12]
}, Closed]],
Cell[CellGroupData[{
Cell[StyleData["Subsubsection"],
CellDingbat->"\[FilledSmallSquare]",
ShowGroupOpenCloseIcon->True,
CellMargins->{{22, Inherited}, {8, 18}},
CellGroupingRules->{"SectionGrouping", 50},
PageBreakBelow->False,
CounterIncrements->"Subsubsection",
FontWeight->"Bold"],
Cell[StyleData["Subsubsection", "Presentation"],
CellMargins->{{34, 10}, {11, 26}},
LineSpacing->{1, 0},
FontSize->18],
Cell[StyleData["Subsubsection", "Condensed"],
CellMargins->{{17, Inherited}, {6, 12}},
FontSize->10],
Cell[StyleData["Subsubsection", "Printout"],
CellMargins->{{9, 0}, {7, 14}},
FontSize->11]
}, Closed]]
}, Closed]],
Cell[CellGroupData[{
Cell["Styles for Body Text", "Section"],
Cell[CellGroupData[{
Cell[StyleData["Text"],
CellMargins->{{12, 10}, {7, 7}},
LineSpacing->{1, 3},
CounterIncrements->"Text"],
Cell[StyleData["Text", "Presentation"],
CellMargins->{{24, 10}, {10, 10}},
LineSpacing->{1, 5}],
Cell[StyleData["Text", "Condensed"],
CellMargins->{{8, 10}, {6, 6}},
LineSpacing->{1, 1}],
Cell[StyleData["Text", "Printout"],
CellMargins->{{2, 2}, {6, 6}}]
}, Closed]],
Cell[CellGroupData[{
Cell[StyleData["SmallText"],
CellMargins->{{12, 10}, {6, 6}},
LineSpacing->{1, 3},
CounterIncrements->"SmallText",
FontFamily->"Helvetica",
FontSize->9],
Cell[StyleData["SmallText", "Presentation"],
CellMargins->{{24, 10}, {8, 8}},
LineSpacing->{1, 5},
FontSize->12],
Cell[StyleData["SmallText", "Condensed"],
CellMargins->{{8, 10}, {5, 5}},
LineSpacing->{1, 2},
FontSize->9],
Cell[StyleData["SmallText", "Printout"],
CellMargins->{{2, 2}, {5, 5}},
FontSize->7]
}, Closed]]
}, Closed]],
Cell[CellGroupData[{
Cell["Styles for Input/Output", "Section",
TabSpacings->1],
Cell["\<\
The cells in this section define styles used for input \
and output to the kernel. Be careful when modifying, renaming, or \
removing these styles, because the front end associates special \
meanings with these style names. Some attributes for these styles are \
actually set in FormatType Styles (in the last section of this \
stylesheet). \
\>", "Text",
TabSpacings->1],
Cell[CellGroupData[{
Cell[StyleData["Input"],
CellMargins->{{45, 10}, {5, 7}},
Evaluatable->True,
CellGroupingRules->"InputGrouping",
PageBreakWithin->False,
GroupPageBreakWithin->False,
CellLabelMargins->{{11, Inherited}, {Inherited, Inherited}},
DefaultFormatType->DefaultInputFormatType,
TabSpacings->1,
AutoItalicWords->{},
FormatType->InputForm,
ShowStringCharacters->True,
NumberMarks->True,
CounterIncrements->"Input",
FontSize->12,
FontWeight->"Bold"],
Cell[StyleData["Input", "Presentation"],
CellMargins->{{72, Inherited}, {8, 10}},
LineSpacing->{1, 0},
TabSpacings->1],
Cell[StyleData["Input", "Condensed"],
CellMargins->{{40, 10}, {2, 3}},
TabSpacings->1],
Cell[StyleData["Input", "Printout"],
CellMargins->{{39, 0}, {4, 6}},
TabSpacings->1,
FontSize->9]
}, Closed]],
Cell[StyleData["InputOnly"],
Evaluatable->True,
CellGroupingRules->"InputGrouping",
DefaultFormatType->DefaultInputFormatType,
TabSpacings->1,
AutoItalicWords->{},
FormatType->InputForm,
ShowStringCharacters->True,
NumberMarks->True,
CounterIncrements->"Input",
StyleMenuListing->None,
FontWeight->"Bold"],
Cell[CellGroupData[{
Cell[StyleData["Output"],
CellMargins->{{47, 10}, {7, 5}},
CellEditDuplicate->True,
CellGroupingRules->"OutputGrouping",
CellHorizontalScrolling->True,
PageBreakWithin->False,
GroupPageBreakWithin->False,
GeneratedCell->True,
CellAutoOverwrite->True,
CellLabelMargins->{{11, Inherited}, {Inherited, Inherited}},
DefaultFormatType->DefaultOutputFormatType,
TabSpacings->1,
AutoItalicWords->{},
FormatType->InputForm,
CounterIncrements->"Output"],
Cell[StyleData["Output", "Presentation"],
CellMargins->{{72, Inherited}, {10, 8}},
LineSpacing->{1, 0},
TabSpacings->1],
Cell[StyleData["Output", "Condensed"],
CellMargins->{{41, Inherited}, {3, 2}},
TabSpacings->1],
Cell[StyleData["Output", "Printout"],
CellMargins->{{39, 0}, {6, 4}},
TabSpacings->1,
FontSize->9]
}, Closed]],
Cell[CellGroupData[{
Cell[StyleData["Message"],
CellMargins->{{45, Inherited}, {Inherited, Inherited}},
CellGroupingRules->"OutputGrouping",
PageBreakWithin->False,
GroupPageBreakWithin->False,
GeneratedCell->True,
CellAutoOverwrite->True,
ShowCellLabel->False,
CellLabelMargins->{{11, Inherited}, {Inherited, Inherited}},
DefaultFormatType->DefaultOutputFormatType,
TabSpacings->1,
AutoItalicWords->{},
FormatType->InputForm,
CounterIncrements->"Message",
StyleMenuListing->None,
FontColor->RGBColor[0, 0, 1]],
Cell[StyleData["Message", "Presentation"],
CellMargins->{{72, Inherited}, {Inherited, Inherited}},
LineSpacing->{1, 0},
TabSpacings->1],
Cell[StyleData["Message", "Condensed"],
CellMargins->{{41, Inherited}, {Inherited, Inherited}},
TabSpacings->1],
Cell[StyleData["Message", "Printout"],
CellMargins->{{39, Inherited}, {Inherited, Inherited}},
TabSpacings->1,
FontSize->8,
FontColor->GrayLevel[0]]
}, Closed]],
Cell[CellGroupData[{
Cell[StyleData["Print"],
CellMargins->{{45, Inherited}, {Inherited, Inherited}},
CellGroupingRules->"OutputGrouping",
PageBreakWithin->False,
GroupPageBreakWithin->False,
GeneratedCell->True,
CellAutoOverwrite->True,
ShowCellLabel->False,
CellLabelMargins->{{11, Inherited}, {Inherited, Inherited}},
DefaultFormatType->DefaultOutputFormatType,
TabSpacings->1,
AutoItalicWords->{},
FormatType->InputForm,
CounterIncrements->"Print",
StyleMenuListing->None],
Cell[StyleData["Print", "Presentation"],
CellMargins->{{72, Inherited}, {Inherited, Inherited}},
LineSpacing->{1, 0},
TabSpacings->1],
Cell[StyleData["Print", "Condensed"],
CellMargins->{{41, Inherited}, {Inherited, Inherited}},
TabSpacings->1],
Cell[StyleData["Print", "Printout"],
CellMargins->{{39, Inherited}, {Inherited, Inherited}},
TabSpacings->1,
FontSize->8]
}, Closed]],
Cell[CellGroupData[{
Cell[StyleData["Graphics"],
CellMargins->{{4, Inherited}, {Inherited, Inherited}},
CellGroupingRules->"GraphicsGrouping",
CellHorizontalScrolling->True,
PageBreakWithin->False,
GeneratedCell->True,
CellAutoOverwrite->True,
ShowCellLabel->False,
DefaultFormatType->DefaultOutputFormatType,
TabSpacings->1,
FormatType->InputForm,
CounterIncrements->"Graphics",
ImageMargins->{{43, Inherited}, {Inherited, 0}},
StyleMenuListing->None],
Cell[StyleData["Graphics", "Presentation"],
TabSpacings->1,
ImageMargins->{{62, Inherited}, {Inherited, 0}}],
Cell[StyleData["Graphics", "Condensed"],
TabSpacings->1,
ImageMargins->{{38, Inherited}, {Inherited, 0}},
Magnification->0.6],
Cell[StyleData["Graphics", "Printout"],
TabSpacings->1,
ImageMargins->{{30, Inherited}, {Inherited, 0}},
FontSize->9,
Magnification->0.8]
}, Closed]],
Cell[CellGroupData[{
Cell[StyleData["CellLabel"],
TabSpacings->1,
StyleMenuListing->None,
FontFamily->"Helvetica",
FontSize->9,
FontColor->RGBColor[0, 0, 1]],
Cell[StyleData["CellLabel", "Presentation"],
TabSpacings->1,
FontSize->12],
Cell[StyleData["CellLabel", "Condensed"],
TabSpacings->1,
FontSize->9],
Cell[StyleData["CellLabel", "Printout"],
TabSpacings->1,
FontFamily->"Courier",
FontSize->8,
FontSlant->"Italic",
FontColor->GrayLevel[0]]
}, Closed]]
}, Open ]],
Cell[CellGroupData[{
Cell["Formulas and Programming", "Section"],
Cell[CellGroupData[{
Cell[StyleData["InlineFormula"],
CellMargins->{{10, 4}, {0, 8}},
CellHorizontalScrolling->True,
ScriptLevel->1,
SingleLetterItalics->True],
Cell[StyleData["InlineFormula", "Presentation"],
CellMargins->{{24, 10}, {10, 10}},
LineSpacing->{1, 5}],
Cell[StyleData["InlineFormula", "Condensed"],
CellMargins->{{8, 10}, {6, 6}},
LineSpacing->{1, 1}],
Cell[StyleData["InlineFormula", "Printout"],
CellMargins->{{2, 0}, {6, 6}}]
}, Closed]],
Cell[CellGroupData[{
Cell[StyleData["DisplayFormula"],
CellMargins->{{42, Inherited}, {Inherited, Inherited}},
CellHorizontalScrolling->True,
DefaultFormatType->DefaultInputFormatType,
ScriptLevel->0,
SingleLetterItalics->True,
UnderoverscriptBoxOptions->{LimitsPositioning->True}],
Cell[StyleData["DisplayFormula", "Presentation"],
LineSpacing->{1, 5}],
Cell[StyleData["DisplayFormula", "Condensed"],
LineSpacing->{1, 1}],
Cell[StyleData["DisplayFormula", "Printout"]]
}, Closed]]
}, Closed]],
Cell[CellGroupData[{
Cell["Styles for Headers and Footers", "Section"],
Cell[StyleData["Header"],
CellMargins->{{0, 0}, {4, 1}},
StyleMenuListing->None,
FontSize->10,
FontSlant->"Italic"],
Cell[StyleData["Footer"],
CellMargins->{{0, 0}, {0, 4}},
StyleMenuListing->None,
FontSize->9,
FontSlant->"Italic"],
Cell[StyleData["PageNumber"],
CellMargins->{{0, 0}, {4, 1}},
StyleMenuListing->None,
FontFamily->"Times",
FontSize->10]
}, Closed]],
Cell[CellGroupData[{
Cell["Palette Styles", "Section"],
Cell["\<\
The cells below define styles that define standard \
ButtonFunctions, for use in palette buttons.\
\>", "Text"],
Cell[StyleData["Paste"],
StyleMenuListing->None,
ButtonStyleMenuListing->Automatic,
ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ {
FrontEnd`NotebookApply[
FrontEnd`InputNotebook[ ], #, After]}]&)}],
Cell[StyleData["Evaluate"],
StyleMenuListing->None,
ButtonStyleMenuListing->Automatic,
ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ {
FrontEnd`NotebookApply[
FrontEnd`InputNotebook[ ], #, All],
SelectionEvaluate[
FrontEnd`InputNotebook[ ], All]}]&)}],
Cell[StyleData["EvaluateCell"],
StyleMenuListing->None,
ButtonStyleMenuListing->Automatic,
ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ {
FrontEnd`NotebookApply[
FrontEnd`InputNotebook[ ], #, All],
FrontEnd`SelectionMove[
FrontEnd`InputNotebook[ ], All, Cell, 1],
FrontEnd`SelectionEvaluateCreateCell[
FrontEnd`InputNotebook[ ], All]}]&)}],
Cell[StyleData["CopyEvaluate"],
StyleMenuListing->None,
ButtonStyleMenuListing->Automatic,
ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ {
FrontEnd`SelectionCreateCell[
FrontEnd`InputNotebook[ ], All],
FrontEnd`NotebookApply[
FrontEnd`InputNotebook[ ], #, All],
FrontEnd`SelectionEvaluate[
FrontEnd`InputNotebook[ ], All]}]&)}],
Cell[StyleData["CopyEvaluateCell"],
StyleMenuListing->None,
ButtonStyleMenuListing->Automatic,
ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ {
FrontEnd`SelectionCreateCell[
FrontEnd`InputNotebook[ ], All],
FrontEnd`NotebookApply[
FrontEnd`InputNotebook[ ], #, All],
FrontEnd`SelectionEvaluateCreateCell[
FrontEnd`InputNotebook[ ], All]}]&)}]
}, Closed]],
Cell[CellGroupData[{
Cell["Hyperlink Styles", "Section"],
Cell["\<\
The cells below define styles useful for making hypertext \
ButtonBoxes. The \"Hyperlink\" style is for links within the same \
Notebook, or between Notebooks.\
\>", "Text"],
Cell[CellGroupData[{
Cell[StyleData["Hyperlink"],
StyleMenuListing->None,
ButtonStyleMenuListing->Automatic,
FontColor->RGBColor[0, 0, 1],
FontVariations->{"Underline"->True},
ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ {
FrontEnd`NotebookLocate[ #2]}]&),
Active->True,
ButtonNote->ButtonData}],
Cell[StyleData["Hyperlink", "Presentation"]],
Cell[StyleData["Hyperlink", "Condensed"]],
Cell[StyleData["Hyperlink", "Printout"],
FontColor->GrayLevel[0],
FontVariations->{"Underline"->False}]
}, Closed]],
Cell["\<\
The following styles are for linking automatically to the \
on-line help system.\
\>", "Text"],
Cell[CellGroupData[{
Cell[StyleData["MainBookLink"],
StyleMenuListing->None,
ButtonStyleMenuListing->Automatic,
FontColor->RGBColor[0, 0, 1],
FontVariations->{"Underline"->True},
ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ {
FrontEnd`HelpBrowserLookup[ "MainBook", #]}]&),
Active->True,
ButtonFrame->"None"}],
Cell[StyleData["MainBookLink", "Presentation"]],
Cell[StyleData["MainBookLink", "Condensed"]],
Cell[StyleData["MainBookLink", "Printout"],
FontColor->GrayLevel[0],
FontVariations->{"Underline"->False}]
}, Closed]],
Cell[CellGroupData[{
Cell[StyleData["AddOnsLink"],
StyleMenuListing->None,
ButtonStyleMenuListing->Automatic,
FontFamily->"Courier",
FontColor->RGBColor[0, 0, 1],
FontVariations->{"Underline"->True},
ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ {
FrontEnd`HelpBrowserLookup[ "AddOns", #]}]&),
Active->True,
ButtonFrame->"None"}],
Cell[StyleData["AddOnsLink", "Presentation"]],
Cell[StyleData["AddOnsLink", "Condensed"]],
Cell[StyleData["AddOnLink", "Printout"],
FontColor->GrayLevel[0],
FontVariations->{"Underline"->False}]
}, Closed]],
Cell[CellGroupData[{
Cell[StyleData["RefGuideLink"],
StyleMenuListing->None,
ButtonStyleMenuListing->Automatic,
FontFamily->"Courier",
FontColor->RGBColor[0, 0, 1],
FontVariations->{"Underline"->True},
ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ {
FrontEnd`HelpBrowserLookup[ "RefGuideLink", #]}]&),
Active->True,
ButtonFrame->"None"}],
Cell[StyleData["RefGuideLink", "Presentation"]],
Cell[StyleData["RefGuideLink", "Condensed"]],
Cell[StyleData["RefGuideLink", "Printout"],
FontColor->GrayLevel[0],
FontVariations->{"Underline"->False}]
}, Closed]],
Cell[CellGroupData[{
Cell[StyleData["GettingStartedLink"],
StyleMenuListing->None,
ButtonStyleMenuListing->Automatic,
FontColor->RGBColor[0, 0, 1],
FontVariations->{"Underline"->True},
ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ {
FrontEnd`HelpBrowserLookup[ "GettingStarted", #]}]&),
Active->True,
ButtonFrame->"None"}],
Cell[StyleData["GettingStartedLink", "Presentation"]],
Cell[StyleData["GettingStartedLink", "Condensed"]],
Cell[StyleData["GettingStartedLink", "Printout"],
FontColor->GrayLevel[0],
FontVariations->{"Underline"->False}]
}, Closed]],
Cell[CellGroupData[{
Cell[StyleData["OtherInformationLink"],
StyleMenuListing->None,
ButtonStyleMenuListing->Automatic,
FontColor->RGBColor[0, 0, 1],
FontVariations->{"Underline"->True},
ButtonBoxOptions->{ButtonFunction:>(FrontEndExecute[ {
FrontEnd`HelpBrowserLookup[ "OtherInformation", #]}]&),
Active->True,
ButtonFrame->"None"}],
Cell[StyleData["OtherInformationLink", "Presentation"]],
Cell[StyleData["OtherInformationLink", "Condensed"]],
Cell[StyleData["OtherInformationLink", "Printout"],
FontColor->GrayLevel[0],
FontVariations->{"Underline"->False}]
}, Closed]]
}, Closed]],
Cell[CellGroupData[{
Cell["Placeholder Styles", "Section"],
Cell["\<\
The cells below define styles useful for making \
placeholder objects in palette templates.\
\>", "Text"],
Cell[CellGroupData[{
Cell[StyleData["Placeholder"],
Editable->False,
Selectable->False,
StyleBoxAutoDelete->True,
Placeholder->True,
StyleMenuListing->None],
Cell[StyleData["Placeholder", "Presentation"]],
Cell[StyleData["Placeholder", "Condensed"]],
Cell[StyleData["Placeholder", "Printout"]]
}, Closed]],
Cell[CellGroupData[{
Cell[StyleData["SelectionPlaceholder"],
Editable->False,
Selectable->False,
StyleBoxAutoDelete->True,
StyleMenuListing->None,
DrawHighlighted->True],
Cell[StyleData["SelectionPlaceholder", "Presentation"]],
Cell[StyleData["SelectionPlaceholder", "Condensed"]],
Cell[StyleData["SelectionPlaceholder", "Printout"]]
}, Closed]]
}, Closed]],
Cell[CellGroupData[{
Cell["FormatType Styles", "Section"],
Cell["\<\
The cells below define styles that are mixed in with the \
styles of most cells. If a cell's FormatType matches the name of one \
of the styles defined below, then that style is applied between the \
cell's style and its own options. This is particularly true of Input \
and Output.\
\>", "Text"],
Cell[StyleData["CellExpression"],
PageWidth->Infinity,
CellMargins->{{6, Inherited}, {Inherited, Inherited}},
ShowCellLabel->False,
ShowSpecialCharacters->False,
AllowInlineCells->False,
AutoItalicWords->{},
StyleMenuListing->None,
FontFamily->"Courier",
FontSize->12,
Background->GrayLevel[1]],
Cell[StyleData["InputForm"],
AllowInlineCells->False,
StyleMenuListing->None,
FontFamily->"Courier"],
Cell[StyleData["OutputForm"],
PageWidth->Infinity,
TextAlignment->Left,
LineSpacing->{0.6, 1},
StyleMenuListing->None,
FontFamily->"Courier"],
Cell[StyleData["StandardForm"],
LineSpacing->{1.25, 0},
StyleMenuListing->None,
FontFamily->"Courier"],
Cell[StyleData["TraditionalForm"],
LineSpacing->{1.25, 0},
SingleLetterItalics->True,
TraditionalFunctionNotation->True,
DelimiterMatching->None,
StyleMenuListing->None],
Cell["\<\
The style defined below is mixed in to any cell that is \
in an inline cell within another.\
\>", "Text"],
Cell[StyleData["InlineCell"],
TextAlignment->Left,
ScriptLevel->1,
StyleMenuListing->None],
Cell[StyleData["InlineCellEditing"],
StyleMenuListing->None,
Background->RGBColor[1, 0.749996, 0.8]]
}, Closed]]
}, Open ]]
}]
]