Template:Sum: Difference between revisions

From LifeWiki
Jump to navigation Jump to search
m wait a minute, https://en.wiktionary.org/wiki/%CE%A3 says "there exists a distinct symbol (∑) for the purpose of the mathematical summation" (the slightly taller one I had previously been using), sorry
m add brac parameter (and explanation of reason thereof, for sums involving single {{choose}}s)
Line 1: Line 1:
<includeonly>∑<span style="display:inline-grid;font-size:0.75em;vertical-align:middle"><span>{{{uppe|{{{2}}}}}}</span><span>{{{lowe|{{{1}}}}}}</span></span>({{{term|{{{3}}}}}})</includeonly><noinclude>This template is for expressing mathematical summations. It uses a vertical grid, so makes the line it inhabits slightly taller. Its parameters may be expressed with their names present or forgone (in which case their order is used).
<includeonly>∑<span style="display:inline-grid;font-size:0.75em;vertical-align:middle"><span>{{{uppe|{{{2}}}}}}</span><span>{{{lowe|{{{1}}}}}}</span></span>{{{brac|(}}}{{{term|{{{3}}}}}}{{{brac|)}}}</includeonly><noinclude><tt><nowiki>{{</nowiki>'''sum'''<nowiki>}}</nowiki></tt> is a template for expressing mathematical summations. It uses a vertical grid, so makes the line it inhabits slightly taller. Its parameters may be expressed with their names present or forgone (in which case their order is used).
* <tt>lowe</tt>: The lower bound
* <tt>lowe</tt>: The lower bound
* <tt>uppe</tt>: The upper bound
* <tt>uppe</tt>: The upper bound
* <tt>term</tt>: The summand
* <tt>term</tt>: The summand
* <tt>brac</tt>: If specified as blank (ie. <tt>...|brac=}}</tt>), removes the bracket pair enclosing the summand. To be used in the event of a summation involving things like <tt>[[:Template:choose|<nowiki>{{</nowiki>choose<nowiki>}}</nowiki>]]</tt>, which have their own brackets, <tt>{{sum|k{{=}}0|n-1|{{choose|k|2}}|brac=}}</tt>.
For instance, <tt><nowiki><tt>{{sum|k{{=}}0|n-1|k}}</tt></nowiki></tt> becomes <tt>{{sum|k{{=}}0|n-1|k}}</tt>. (Note that <tt>[[:Template:=|<nowiki>{{=}}</nowiki>]]</tt> must be used in place of <tt>=</tt>, which is otherwise accepted as a parameter and may cause problems.)
For instance, <tt><nowiki><tt>{{sum|k{{=}}0|n-1|k}}</tt></nowiki></tt> becomes <tt>{{sum|k{{=}}0|n-1|k}}</tt>. (Note that <tt>[[:Template:=|<nowiki>{{=}}</nowiki>]]</tt> must be used in place of <tt>=</tt>, which is otherwise accepted as a parameter and may cause problems.)


If you find this workaround inelegant, go <s>pester</s> politely ask Nathaniel Johnston to give us the MediaWiki LaTeX extension.</noinclude>
If you find this workaround inelegant, go <s>pester</s> politely ask Nathaniel Johnston to give us the MediaWiki LaTeX extension.
 
:<tt></tt>{{DISPLAYTITLE:Template:sum}}</noinclude>

Revision as of 09:33, 3 September 2023

{{sum}} is a template for expressing mathematical summations. It uses a vertical grid, so makes the line it inhabits slightly taller. Its parameters may be expressed with their names present or forgone (in which case their order is used).

  • lowe: The lower bound
  • uppe: The upper bound
  • term: The summand
  • brac: If specified as blank (ie. ...|brac=}}), removes the bracket pair enclosing the summand. To be used in the event of a summation involving things like {{choose}}, which have their own brackets, ∑n-1k=0(k2).

For instance, <tt>{{sum|k{{=}}0|n-1|k}}</tt> becomes ∑n-1k=0(k). (Note that {{=}} must be used in place of =, which is otherwise accepted as a parameter and may cause problems.)

If you find this workaround inelegant, go pester politely ask Nathaniel Johnston to give us the MediaWiki LaTeX extension.