This site is supported by donations to The OEIS Foundation.

# Template:Norm/doc

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

[⧼Purge⧽ Template:Norm/doc]

This template is under construction.

Please do not use this unfinished and/or still unreliable template.

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

## Usage

{{norm|expression|format}}

or

{{norm|expression|degree|format}}

or

{{norm|expression yielding a numerical n-vector, n in {1, 2, 3, 4}|#}}

or

{{norm|expression yielding a numerical n-vector, n in {1, 2, 3, 4}|degree|#}}

where

• the first argument is a mathematical expression;
• the second argument is the degree  p, p   ≥   1,
of the norm (default  2
, i.e. Euclidean norm);

and the last (either second or third) argument is one of

• htm: HTML+CSS [single line] markup (default),
• HTM: HTML+CSS [multiline] markup,
• tex: LaTeX [single line] markup,
• TEX: LaTeX [multiline] markup,
• #: numerical result.

As an alternative to using LaTeX rendered PNG images (tex or TEX options), the htm or HTM options will produce an HTML+CSS formatted expression. (Do not use this option inside $...$ tags.)

NOTE: To get rendered LaTeX, you must use the {{math}} template (or {{#tag:math|...}}, although you should use the {{math}} template for consistent formatting, e.g. font face and font size), since you cannot evaluate templates, parser functions or magic words inside $...$ tags.

## Valid input

A mathematical expression. If the numerical result is wanted, the expression must yield an [unformatted] numerical
 n
-vector,
 n ∈ {1, 2, 3, 4}
(see unformatted numbers and remove format from formatted numbers for numerical evaluation).

## Examples

Code Result
{{math| {{norm}} |&}}
 || · ||
{{math| {{norm|htm}} |&}}
 || · ||
{{math| {{norm|tex}} |$}} ${\displaystyle \textstyle {\Vert {\;\;\!\!\!}\cdot \Vert }}$ {{math| {{norm|''x''}} |&}}  || x || {{math| {{norm|''x''|tex}} |$}} ${\displaystyle \textstyle {\Vert {\;\;\!\!\!}x\Vert }}$
{{math| {{norm|''x''}} |&&}}
 || x ||
{{math| {{norm|''x''|tex}} |$$}} ${\displaystyle {\begin{array}{l}\displaystyle {\Vert {\;\;\!\!\!}x\Vert }\end{array}}}$ ### Examples with numerical evaluation Code Result {{math| {{norm|{{op|-}}6}} {{=}} {{norm|{{op|-}}6|#}} |&}}  || − 6 || = 6 {{math| {{norm|{{op|-}}6.5}} {{=}} {{norm|{{op|-}}6.5|#}} |&}}  || − 6.5 || = 6.5 {{math| {{norm|6.5}} {{=}} {{norm|6.5|#}} |&}}  || 6.5 || = 6.5 {{math| {{norm|{{op|+}}6}} {{=}} {{norm|{{op|+}}6|#}} |&}}  || + 6 || = 6 {{math| {{norm|0}} {{=}} {{norm|0|#}} |&}}  || 0 || = 0 {{math| {{norm|{{op|-}}6.5e+45}} {{=}} {{norm|{{op|-}}6.5e+45|#}} |&}}  || − 6.5e+45 || = 6.5E+45 {{math| {{norm|{{op|-}}6E-12}} {{=}} {{norm|{{op|-}}6E-12|#}} |&}}  || − 6E-12 || = 6.0E − 12 {{math| {{norm|{{op|-}}6E{{op|-}}12}} {{=}} {{norm|{{op|-}}6E{{op|-}}12|#}} |&}}  || − 6E − 12 || = 6.0E − 12 {{math| {{norm|6,500}} {{=}} {{norm|{{formatnum: 6,500|R}}|#}} |&}}  || 6,500 || = 6500 {{math| {{norm|3; 4}} {{=}} {{norm|3; 4|#}} |&}}  || 3; 4 || = 5 {{math| {{norm|{{op|-}}3; {{op|-}}4}} {{=}} {{norm|{{op|-}}3; {{op|-}}4|#}} |&}}  || − 3; − 4 || = 5 {{math| {{norm|1; 1}} {{=}} {{norm|1; 1|#}} |&}}  || 1; 1 || = 1.4142135623731 {{math| {{norm|{{op|-}}3; {{op|-}}4; 1}} {{=}} {{norm|{{op|-}}3; {{op|-}}4; 1|#}} |&}}  || − 3; − 4; 1 || = 5.0990195135928 {{math| {{norm|{{op|-}}3; {{op|-}}4; 1; 1}} {{=}} {{norm|{{op|-}}3; {{op|-}}4; 1; 1|#}} |&}}  || − 3; − 4; 1; 1 || = 5.1961524227066 {{math| {{norm|3; 4|3}} {{=}} {{norm|3; 4|3|#}} |&}}  || 3; 4 ||3 = 4.4979414452754 {{math| {{norm|{{op|-}}6}} {{=}} {{norm|{{op|-}}6|#}} |&}}  || − 6 || = 6 {{math| {{norm|{{op|-|tex}}6|tex}} {{=}} {{norm|{{op|-|tex}}6|#}} |}} ${\displaystyle \textstyle {{\Vert {\;\;\!\!\!}{\;{\,}\!\!}-6\Vert }=6}}$ {{math| {{norm|{{op|-}}6}} {{=}} {{norm|{{op|-}}6|#}} |&&}}  || −6 || = 6 {{math| {{norm|{{op|-|tex}}6|tex}} {{=}} {{norm|{{op|-|tex}}6|#}} |$$}} ${\displaystyle {\begin{array}{l}\displaystyle {{\Vert {\;\;\!\!\!}{\;{\,}\!\!}-6\Vert }=6}\end{array}}}$
{{math| {{norm|3; 4}} {{=}} {{norm|3; 4|#}} |&&}}
 || 3; 4 || = 5
{{math| {{norm|3; 4|tex}} {{=}} {{norm|3; 4|#}} |$$}} ${\displaystyle {\begin{array}{l}\displaystyle {{\Vert {\;\;\!\!\!}3;{\,}4\Vert }=5}\end{array}}}$ {{math| {{norm|{{op|-}}3; {{op|-}}4|HTM}} {{=}} {{norm|{{op|-}}3; {{op|-}}4|#}} |&}}  − 3; − 4 = 5 {{math| {{norm|{{op|-}}3; {{op|-}}4|TEX}} {{=}} {{norm|{{op|-}}3; {{op|-}}4|#}} |}} ${\displaystyle \textstyle {{\left\Vert -3;{\,}-4\right\Vert }=5}}$ {{math| {{norm|1; 1}} {{=}} {{norm|1; 1|#}} |&}}  || 1; 1 || = 1.4142135623731 {{math| {{norm|1; 1|tex}} {{=}} {{norm|1; 1|#}} |}} ${\displaystyle \textstyle {{\Vert {\;\;\!\!\!}1;{\,}1\Vert }=1.4142135623731}}$ {{math| {{norm|{{op|-}}3; {{op|-}}4; 1}} {{=}} {{norm|{{op|-}}3; {{op|-}}4; 1|#}} |&&}}  || −3; −4; 1 || = 5.0990195135928 {{math| {{norm|{{op|-}}3; {{op|-}}4; 1|tex}} {{=}} {{norm|{{op|-}}3; {{op|-}}4; 1|#}} |$$}} ${\displaystyle {\begin{array}{l}\displaystyle {{\Vert {\;\;\!\!\!}{\;{\,}\!\!}-3;{\,}{\;{\,}\!\!}-4;{\,}1\Vert }=5.0990195135928}\end{array}}}$
{{math| {{norm|{{op|-}}3; {{op|-}}4; 1; 1|HTM}} {{=}} {{norm|{{op|-}}3; {{op|-}}4; 1; 1|#}} |&}}
 − 3;  − 4; 1; 1
= 5.1961524227066
{{math| {{norm|{{op|-}}3; {{op|-}}4; 1; 1|TEX}} {{=}} {{norm|{{op|-}}3; {{op|-}}4; 1; 1|#}} |$}} ${\displaystyle \textstyle {{\left\Vert -3;{\,}-4;{\,}1;{\,}1\right\Vert }=5.1961524227066}}$ {{math| {{norm|3; 4|3|HTM}} {{=}} {{norm|3; 4|3|#}} |&&}}  3; 4 3 = 4.4979414452754 {{math| {{norm|3; 4|3|TEX}} {{=}} {{norm|3; 4|3|#}} |$$}} ${\displaystyle {\begin{array}{l}\displaystyle {{\left\Vert 3;{\,}4\right\Vert }_{3}=4.4979414452754}\end{array}}}$ ### More elaborate examples The code {{math| ''x''{{^|3}} {{op|-}} ''x''{{^|2}} {{op|+}} 1 |&&}}, {{math| ''x''{{^|3|tex}} {{op|-|tex}} ''x''{{^|2|tex}} {{op|+|tex}} 1 |$$}} yields the HTML+CSS formatted, LaTeX formatted  x 3 − x 2 + 1 ,${\displaystyle {\begin{array}{l}\displaystyle {x^{3}-x^{2}+1}\end{array}}}$ while the code {{math| ''x''{{^|3}} {{op|-}} ''x''{{^|2}} {{op|+}} 1 |&}}, {{math| ''x''{{^|3|tex}} {{op|-|tex}} ''x''{{^|2|tex}} {{op|+|tex}} 1 |$}}

yields the HTML+CSS formatted, LaTeX formatted

 x 3  −  x 2  +  1
,${\displaystyle \textstyle {x^{3}{\,}-{\,}x^{2}+1}}$

The code

{{math| {{norm| ''x''{{^|3}} {{op|-}} ''x''{{^|2}} {{op|+}} 1 |HTM}} |&&}}, {{math| {{norm| ''x''{{^|3|tex}} {{op|-|tex}} ''x''{{^|2|tex}} {{op|+|tex}} 1 |TEX}} |$$}} yields the HTML+CSS formatted, LaTeX formatted  x 3 − x 2 + 1 ,${\displaystyle {\begin{array}{l}\displaystyle {\left\Vert x^{3}-x^{2}+1\right\Vert }\end{array}}}$ while the code {{math| {{norm| ''x''{{^|3}} {{op|-}} ''x''{{^|2}} {{op|+}} 1 |HTM}} |&}}, {{math| {{norm| ''x''{{^|3|tex}} {{op|-|tex}} ''x''{{^|2|tex}} {{op|+|tex}} 1 |TEX}} |}} yields the HTML+CSS formatted, LaTeX formatted  x 3 − x 2 + 1 ,${\displaystyle \textstyle {\left\Vert x^{3}-x^{2}+1\right\Vert }}$ The code {{math| {{norm| {{frac| 1 | ''x''{{^|3}} {{op|-}} ''x''{{^|2}} {{op|+}} 1 |HTM}} |HTM}} |&&}}, {{math| {{norm| {{frac| 1 | ''x''{{^|3|tex}} {{op|-|tex}} ''x''{{^|2|tex}} {{op|+|tex}} 1 |TEX}} |TEX}} |$$}}

yields the HTML+CSS formatted, LaTeX formatted

 1 x 3 − x 2 + 1
,${\displaystyle {\begin{array}{l}\displaystyle {\left\Vert {\frac {1}{x^{3}-x^{2}+1}}\right\Vert }\end{array}}}$

while the code

{{math| {{norm| {{frac| 1 | ''x''{{^|3}} {{op|-}} ''x''{{^|2}} {{op|+}} 1 |htm}} |HTM}} |&}}, {{math| {{norm| {{frac| 1 | ''x''{{^|3|tex}} {{op|-|tex}} ''x''{{^|2|tex}} {{op|+|tex}} 1 |tex}} |TEX}} |\$}}

yields the HTML+CSS formatted, LaTeX formatted

 1 x 3  −  x 2  +  1
,${\displaystyle \textstyle {\left\Vert {\frac {1}{x^{3}-x^{2}+1}}\right\Vert }}$

### Examples with invalid input

Code Result Comment
{{norm|#}} Expression error: Unrecognized word "strong".
{{norm|6,500|#}} Expression error: Unrecognized word "strong". (formatted numbers are not allowed)
{{norm|i|#}} Expression error: Unrecognized word "strong".
{{norm|blob|#}} Expression error: Unrecognized word "strong".
{{norm|6 blobs|#}} Expression error: Unrecognized word "strong".