This site is supported by donations to The OEIS Foundation.
Template:Sum/doc
though with some compromises to obtain [more or less] acceptable results with MS Internet Explorer (or now MS Edge) and Google Chrome.
The {{sum}} (summation operator) mathematical formatting template is used to obtain an HTML+CSS or a LaTeX formatted summation expression.
Contents
Usage
- {{sum|from|to}} (followed by summand, as with LaTeX; format defaults to
htm
)
or
- {{sum|from|to|format}} (followed by summand, as with LaTeX)
or
- {{sum|from|to|summand}}
or
- {{sum|from|to|summand|format}}
where format is one of the following:
-
htm
: HTML+CSS markup (text style, with postscript limits) for summation expression (default); -
HTM
: HTML+CSS markup (display style, with underscript/overscript limits) for summation expression; -
tex
: LaTeX markup (text style, with postscript limits) for summation expression; -
TEX
: LaTeX markup (display style, with underscript/overscript limits) for summation expression.
Examples
The code
-
: line of text above{{nl}}another line of text above{{nl}}before {{math|{{sum|''i''{{=}}1|''n''|''i''{{^|3}}}}|&}} after{{nl}}line of text below{{nl}}another line of text below
yields the text style HTML+CSS
- line of text above
another line of text above
before
after∑ ni = 1i 3
line of text below
another line of text below
The code
-
: line of text above{{nl}}another line of text above{{nl}}before {{math|{{sum|''i''{{=}}1|''n''|''i''{{^|3|tex}}|tex}}|$}} after{{nl}}line of text below{{nl}}another line of text below
yields the text style LaTeX
- line of text above
another line of text above
before after
line of text below
another line of text below
The code
-
: {{math|{{sum|''i''{{=}}1|''n''|''i''{{^|3|HTM}}|HTM}}|&&}}
yields the display style HTML+CSS
- n
∑ i = 1i 3
The code
-
: {{math|{{sum|''i''{{=}}1|''n''|''i''{{^|3|TEX}}|TEX}}|$$}}
yields the display style LaTeX
The code
: (...) "numbers {{math|''n''|tex = n|&}} such that <!-- -->{{math|''n''{{sp|2}}(''n'' + 1) {{=}} {{sum|''i''{{=}}1|''x''|(''n'' + ''i''{{sp|1}})}} {{=}} ''n''{{sp|1}}''x'' + {{sum|''i''{{=}}1|''x''|''i''}} |tex = n (n + 1) = \sum_{i=1}^{x} (n + i) = nx + \sum_{i=1}^{x} i |&}} for some {{math|''x''|tex = x|&}}," except of course for the first term.
yields the text style HTML+CSS
- (...) "numbers
such thatn
for somen (n + 1) = ∑ xi = 1(n + i )= n x +∑ xi = 1i
," except of course for the first term.x
and, with the $
argument, yields the text style LaTeX
- (...) "numbers such that for some ," except of course for the first term.
Examples with fraction
The code
-
: before {{math|{{sum|''k''{{=}}1|infty|{{frac|''n''{{^|''k''}}|''n''!|htm}}|htm}}|&}} after
yields the text style HTML+CSS
- before
after∑ ∞k = 1n k n!
The code
-
: before {{math|{{sum|''k''{{=}}1|infty|{{frac|''n''{{^|''k''|tex}}|''n''!|tex}}|tex}}|$}} after
yields the text style LaTeX
- before after
The code
-
:{{math| {{sum|''k''{{=}}1|infty|{{frac|''n''{{^|''k''|HTM}}|''n''!|HTM}}|HTM}}|&&}}
yields the display style HTML+CSS
- ∞
∑ k = 1n k n!
The code
-
: {{math|{{sum|''k''{{=}}1|infty|{{frac|''n''{{^|''k''|TEX}}|''n''!|TEX}}|TEX}}|$$}}
yields the display style LaTeX
Examples with equality
The code
{{indent}}before {{math|{{fn|sin}} ''x'' {{=}} <!-- -->{{sum|''n''{{=}}1{{nl}}''n'' odd|{{sp|1}}{{nl}}infty|({{op|-}}1){{^|{{floor|''n''{{op|/}}2}}}}{{sp|6}}{{frac|''x''{{^|''n''}}|''n''!|htm}}}} |&}} after
yields the text style HTML+CSS
beforesin x =
( − 1) ⌊ n / 2⌋
|
The code
{{indent}}before {{math|{{fn|sin|tex}} ''x'' {{=}} <!-- -->{{sum|\stackrel{\scriptstyle ''n''{{=}}1}{''n'' \text{ odd} }|infty|({{op|-}}1){{^|{{floor|''n''/2|tex}}|tex}}{{sp|3|tex}}{{frac|''x''{{^|''n''|tex}}|''n''!|tex}}|tex}} |$}} after
yields the text style LaTeX
before after
The code
{{indent}}{{math|{{fn|sin}} ''x'' {{=}} <!-- -->{{sum|''n''{{=}}1{{nl}}''n'' odd|{{nl|2}}infty|({{op|-}}1){{^|{{floor|''n''{{op|/}}2}}|HTM}}{{sp|6}}{{frac|''x''{{^|''n''|HTM}}|''n''!|HTM}}|HTM}} |&&}}
yields the display style HTML+CSS
sin x =
(−1) ⌊ n / 2⌋
|
while the code
{{indent}}{{math|{{fn|sin|tex}} ''x'' {{=}} <!-- -->{{sum|\stackrel{\scriptstyle ''n''{{=}}1}{''n'' \text{ odd} }|infty|({{op|-}}1){{^|{{floor|''n''/2|tex}}|tex}} {{frac|''x''{{^|''n''|tex}}|''n''!|TEX}}|TEX}} |$$}}
yields the display style LaTeX
Examples with nested summations
The code
: before {{math|<!-- -->{{sum|''i''{{=}}1|''p''<!-- -->|{{sum|''j''{{=}}1|''q''<!-- -->|{{sum|''k''{{=}}1|''r''<!-- -->|''a''{{sub|''i''{{sp|2}}''j''}}{{sp|2}}''b''{{sub|''j''{{sp|1}}''k''}}{{sp|3}}''c''{{sub|''k''{{sp|1}}''i''}}<!-- -->|htm}}<!-- -->|htm}}<!-- -->|htm}}<!-- --> |&}} after
yields the text style HTML+CSS
- before
after∑ pi = 1∑ qj = 1∑ rk = 1ai j bj k ck i
while the code
: {{math|<!-- -->{{sum|''i''{{=}}1|''p''<!-- -->|{{sum|''j''{{=}}1|''q''<!-- -->|{{sum|''k''{{=}}1|''r''<!-- -->|''a''{{sub|''ij''|tex}}{{sp|2|tex}}''b''{{sub|''jk''|tex}}{{sp|3|tex}}''c''{{sub|''ki''|tex}}<!-- -->|tex}}<!-- -->|tex}}<!-- -->|tex}}<!-- --> |$}} after
yields the text style LaTeX
- before after
The code
: before {{math|<!-- -->{{sum|''i''{{=}}1|''p''<!-- -->|{{sum|''j''{{=}}1|''q''<!-- -->|{{sum|''k''{{=}}1|''r''<!-- -->|''a''{{sub|''i''{{sp|2}}''j''|HTM}}{{sp|2}}''b''{{sub|''j''{{sp|1}}''k''|HTM}}{{sp|2}}''c''{{sub|''k''{{sp|1}}''i''|HTM}}<!-- -->|HTM}}<!-- -->|HTM}}<!-- -->|HTM}}<!-- --> |&&}}
yields the display style HTML+CSS
- p
∑ i = 1q∑ j = 1r∑ k = 1ai j bj k ck i
while the code
: {{math|<!-- -->{{sum|''i''{{=}}1|''p''<!-- -->|{{sum|''j''{{=}}1|''q''<!-- -->|{{sum|''k''{{=}}1|''r''<!-- -->|''a''{{sub|''ij''|tex}}{{sp|1|tex}}''b''{{sub|''jk''|tex}}{{sp|2|tex}}''c''{{sub|''ki''|tex}}<!-- -->|TEX}}<!-- -->|TEX}}<!-- -->|TEX}}<!-- --> |$$}}
yields the display style LaTeX