This site is supported by donations to The OEIS Foundation.

Template:Norm/doc

From OeisWiki
Jump to: navigation, search

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

[⧼Purge⧽ Template:Norm/doc]

alt = This template is under construction...
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 <math>...</math> 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 <math>...</math> 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}} |$}}
{{math| {{norm|''x''}} |&}}
|| x ||
{{math| {{norm|''x''|tex}} |$}}
{{math| {{norm|''x''}} |&&}}
|| x ||
{{math| {{norm|''x''|tex}} |$$}}

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|#}} |$}}
{{math| {{norm|{{op|-}}6}} {{=}} {{norm|{{op|-}}6|#}} |&&}}
|| −6 ||
= 6
{{math| {{norm|{{op|-|tex}}6|tex}} {{=}} {{norm|{{op|-|tex}}6|#}} |$$}}
{{math| {{norm|3; 4}} {{=}} {{norm|3; 4|#}} |&&}}
|| 3; 4 ||
= 5
{{math| {{norm|3; 4|tex}} {{=}} {{norm|3; 4|#}} |$$}}
{{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|#}} |$}}
{{math| {{norm|1; 1}} {{=}} {{norm|1; 1|#}} |&}}
|| 1; 1 ||
= 1.4142135623731
{{math| {{norm|1; 1|tex}} {{=}} {{norm|1; 1|#}} |$}}
{{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|#}} |$$}}
{{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|#}} |$}}
{{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|#}} |$$}}

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 3x 2 + 1
,

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
,

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 3x 2 + 1 
,

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 
,

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 3x 2 + 1
,

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
,

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".

See also

  • {{abs}} to typeset and/or obtain the absolute value of a real number (or the abs function with {{#expr: }})
  • {{sgn}} to typeset and/or obtain the sign of a real number (note that the sgn function is not supported by {{#expr: }})