This site is supported by donations to The OEIS Foundation.

Template:Sum/doc

From OeisWiki
Jump to: navigation, search

This documentation subpage contains instructions, categories, or other information for Template:Sum. [<Edit> Template:Sum]

[⧼Purge⧽ Template:Sum/doc]

This template have been optimized (in the case of HTML+CSS typesetting) for Firefox,
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.

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 
n

i  = 1
i 3
after
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  = 1
  i 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
n
such that
n  (n + 1) =
x

i  = 1
 (n + i )
= nx +
x

i  = 1
i
for some
x
," except of course for the first term.

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 

k  = 1
nk
n!
after

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  = 1
  
nk
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

     before 
sin  x =


n  = 1

n odd
 ( − 1)
⌊  n / 2⌋
xn
n!
after

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 =


n  = 1
n odd
  (−1)
⌊  n / 2⌋
xn
n!

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 
p

i  = 1
q

j  = 1
r

k  = 1
ai  j  bjkcki
after

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  = 1
  
q
j  = 1
  
r
k  = 1
  ai  j  bjk  cki

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

See also