This site is supported by donations to The OEIS Foundation.

Template:Root

From OeisWiki
Jump to: navigation, search

The {{root}} mathematical formatting template and/or mathematical function template gives either an HTML+CSS or a LaTeX formatted root expression and/or the numerical result of the root expression.

Usage

{{root|radicand}} (square root with invisible root index: please use {{sqrt}} instead)

or

{{root|radicand|format}} (square root with invisible root index: please use {{sqrt}} instead)

or

{{root|radicand|index}}

or

{{root|radicand|index|format}}

where format is taken from:

  • htm: HTML+CSS markup for normal size root expression (default);
  • HTM: HTML+CSS markup for larger size root expression;
  • tex or TEX: LaTeX markup for (normal size or larger size(s) automatically taken care of by LaTeX) root expression;
  • #: numerical result (of a numerical root expression which evaluates to a real number).

NOTE: You must use the {{root}} template within the {{math}} template, which completes the formatting for mathematical expressions. (You cannot use the {{root}} template inside <math>...</math> tags.)

NOTE: To get rendered LaTeX, you must use the {{math}} template, since you cannot evaluate templates, parser functions or magic words inside <math>...</math> tags.

Minus sign issue

  • Use {{op|-}} (i.e. with hyphen argument) for minus sign (instead of -, the hyphen, hyphus or hyphen minus sign {{dash|hyphus}}) in the provided mathematical expression, because the border-top: thin solid; used to make the vinculum of radicals in the {{root}} template turns out to be made out of hyphens -, so we cannot convert the {{dash|hyphus}} into proper {{dash|minus}} − signs for the HTML+CSS renderings, v.g.
√<span style="border-top: thin solid;">2,000,000</span> yields √2,000,000
{{#replace: √<span style="border-top: thin solid;">2,000,000</span> |-|&minus;}} yields √2,000,000
  • Using {{op|-}} (i.e. with hyphen argument) yields @opsp@−@opsp@ (i.e. {{dash|minus}} surrounded by @opsp@ annotations for operator spacing used by the {{math}} template) in the {{math}} template for the HTML+CSS renderings (for LaTeX renderings, the {{dash|hyphus}} is properly turned into {{dash|minus}} by the LaTeX software).

Examples

Value of \sqrt{2}

: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|2|#}}{{...|ldots}}|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style HTML+CSS
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before 
1.4142135623731
after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|2|#}}{{...|ldots|tex}}|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style LaTeX
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{math|{{root|2|#}}{{...|ldots}}|&&}}
yields the display style HTML+CSS
1.4142135623731

: {{math|{{root|2|#}}{{...|ldots|tex}}|$$}}
yields the display style LaTeX

\sqrt{2}

: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|2}}|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style HTML+CSS
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before 
2  2
after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|2|tex}}|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style LaTeX
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{math|{{root|2}}|&&}}
yields the display style HTML+CSS
2  2
: {{math|{{root|2|tex}}|$$}}
yields the display style LaTeX

\sqrt{2} = value of \sqrt{2}

: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|2}} {{=}} {{root|2|#}}{{...|ldots}}|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style HTML+CSS
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before 
2  2
= 1.4142135623731
after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math| {{root|2|tex}} {{=}} {{root|2|#}}{{...|ldots|tex}}|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style LaTeX
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{math|{{root|2}} {{=}} {{root|2|#}}{{...|ldots}}|&&}}
yields the display style HTML+CSS
2  2
= 1.4142135623731
: {{math|{{root|2|tex}} {{=}} {{root|2|#}}{{...|ldots|tex}}|$$}}
yields the display style LaTeX

Value of \sqrt[7]{2}

: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|2|7|#}}{{...|ldots}}|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style HTML+CSS
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before 
1.1040895136738
after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|2|7|#}}{{...|ldots|tex}}|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style LaTeX
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{math|{{root|2|7|#}}{{...|ldots}}|&&}}
yields the display style HTML+CSS
1.1040895136738

: {{math|{{root|2|7|#}}{{...|ldots|tex}}|$$}}
yields the display style LaTeX

\sqrt[7]{2}

: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|2|7}}|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style HTML+CSS
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before 
7  2
after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|2|7|tex}}|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style LaTeX
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{math|{{root|2|7}}|&&}}
yields the display style HTML+CSS
7  2
: {{math|{{root|2|7|tex}}|$$}}
yields the display style LaTeX

\sqrt[7]{2} = value of \sqrt[7]{2}

: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|2|7}} {{=}} {{root|2|7|#}}{{...|ldots}}|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style HTML+CSS
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before 
7  2
= 1.1040895136738
after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|2|7|tex}} {{=}} {{root|2|7|#}}{{...|ldots|tex}}|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style LaTeX
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{math|{{root|2|7}} {{=|sp}} {{root|2|7|#}}{{...|ldots}}|&&}}
yields the display style HTML+CSS
7  2
 =  1.1040895136738
: {{math|{{root|2|7|tex}} {{=}} {{root|2|7|#}}{{...|ldots|tex}}|$$}}
yields the display style LaTeX

\frac{ \sqrt{-3} }{2}

: {{math|''{{Gr|omega}}'' {{sp}}{{sym|def}}{{sp}} ''e''{{^|''i''{{sp|2}}2{{sp|1}}{{Gr|pi}}{{op|/}}3}} {{=|sp}} {{op|-}} {{frac|1|2}} + {{frac|{{sqrt|{{op|-}}3}}|2}}{{sp|1}},
|tex = \omega := e^{i \, 2 \pi / 3 } = - \frac{1}{2} + \frac{ \sqrt{-3} }{2},|&&}}
yields the display style HTML+CSS
ω:=  ei  2 π / 3  =  −
1
2
+
2  −3
2
 ,

and with the $$ option, yields the display style LaTeX

\sqrt{x^2 + 1}

: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{sqrt|''x''{{^|2}} {{op|+}} 1}}|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style HTML+CSS
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before 
2  x 2  +  1
after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{sqrt|''x''{{^|2|tex}} {{op|+}} 1|tex}}|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style LaTeX
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{math|{{sqrt|''x''{{^|2}} {{op|+}} 1}}|&&}}
yields the display style HTML+CSS
2  x 2 + 1
: {{math|{{sqrt|''x''{{^|2|tex}} {{op|+}} 1|tex}}|$$}}
yields the display style LaTeX

\sqrt[31]{x^2 - xy + 1}

: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|''x''{{^|2}} {{op|-}} ''xy'' {{op|+}} 1|31}}|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style HTML+CSS
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before 
31  x 2  −  xy  +  1
after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|''x''{{^|2|tex}} {{op|-}} xy {{op|+}} 1|31|tex}}|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style LaTeX
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{math|{{root|''x''{{^|2}} {{op|-}} ''xy'' {{op|+}} 1|31}}|&&}}
yields the display style HTML+CSS
31  x 2xy + 1
: {{math|{{root|''x''{{^|2|tex}} {{op|-}} xy {{op|+}} 1|31|tex}}|$$}}
yields the display style LaTeX

\sqrt[31]{x^2 - \sqrt{xy} + 1}

: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|''x''{{^|2}} {{op|-}} {{sqrt|''xy''}} {{op|+}} 1|31|HTM}}|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style HTML+CSS
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before 
31  x 2  − 
2  xy
 +  1 
after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|x^2 - {{sqrt|xy|tex}} + 1|31|tex}}|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style LaTeX
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{math|{{root|''x''{{^|2}} {{op|-}} {{sqrt|''xy''}} {{op|+}} 1|31|HTM}}|&&}}
yields the display style HTML+CSS
31  x 2
2  xy
+ 1 
: {{math|{{root|x^2 - {{sqrt|xy|tex}} + 1|31|tex}}|$$}}
yields the display style LaTeX

\sqrt[31]{x^2 - \sqrt[3]{xy} + 1}

: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|''x''{{^|2}} {{op|-}} {{root|''xy''|3}} {{op|+}} 1|31|HTM}}|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style HTML+CSS
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before 
31  x 2  − 
3  xy
 +  1 
after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|''x''{{^|2|tex}} {{op|-}} {{root|xy|3|tex}} {{op|+}} 1|31|tex}}|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style LaTeX
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{math|{{root|''x''{{^|2}} {{op|-}} {{root|''xy''|3}} {{op|+}} 1|31|HTM}}|&&}}
yields the display style HTML+CSS
31  x 2
3  xy
+ 1 
: {{math|{{root|''x''{{^|2|tex}} {{op|-}} {{root|xy|3|tex}} {{op|+}} 1|31|tex}}|$$}}
yields the display style LaTeX

\sqrt[31]{x^2 - \left( \tfrac{x + 1}{z - 1} \right) + 1}

: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|''x''{{^|2}} {{op|-}} {{(|{{sp|-2}}{{tfrac|''x'' {{op|+}} 1|''z'' {{op|-}} 1}}{{sp|-3}}|)}} {{op|+}} 1|31|HTM}}|&}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style HTML+CSS
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before 
31  x 2  − 
x  +  1
z  −  1
 +  1 
after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{repeat|2|{{repeat|5|yadda{{nbsp}}}}{{nl}}}}before {{math|{{root|x^2 - \left( \! \tfrac{x \,+\, 1}{z \,-\, 1} \! \right) + 1|31|tex}}|$}} after{{repeat|2|{{nl}}{{repeat|5|yadda{{nbsp}}}}}}
yields the text style LaTeX
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
before after
yadda yadda yadda yadda yadda 
yadda yadda yadda yadda yadda 
: {{math|{{root|''x''{{^|2}} {{op|-}} {{(|{{sp|-2}}{{tfrac|''x'' {{op|+}} 1|''z'' {{op|-}} 1}}{{sp|-3}}|)}} {{op|+}} 1|31|HTM}}|&&}}
yields the display style HTML+CSS
31  x 2
x + 1
z − 1
+ 1 
: {{math|{{root|x^2 - \left( \tfrac{x + 1}{z - 1} \right) + 1|31|tex}}|$$}}
yields the display style LaTeX

Examples with invalid arguments

These root expressions cannot be evaluated since the root arguments are not numerical expressions:

{{root|x^2 + 1|#}} yields Expression error: Unrecognized word "x".
{{root|x^2 + 1|7|#}} yields Expression error: Unrecognized word "x".