Template talk:Power v2

Documentation edit

Wikitext edit

This Template:Power v2 (talk, backlinks, edit) contains:


{{array |index={{{1}}} |4,2=16 |4,3=64 |5,2=25 |5,3=125 |default=n.a. }}


Purpose edit

This template contains a very small demo table of powers, which is also a demo of a 2D array in general.

Usage edit

{{Power
 |a
 |b
}}

gives ab for values in the table, "n.a." otherwise.

Examples edit

Code Result
{{Power v2|4,2}} 16
{{Power v2|4,3}} 64
{{Power v2|5,2}} 25
{{Power v2|5,3}} 125
{{Power v2|5,4}} n.a.

A for-call can give a row or column of choice:

{{for|sep=,|1|2|3|4|call=power v2|prefix=4,}} gives 161641n.a.

{{for|sep=,|1|2|3|4|call=power v2|prefix=5,}} gives 2511251n.a.

{{for|sep=,|1|2|3|4|call=power v2|postfix=,2}} gives n.a.1n.a.116

{{for|sep=,|1|2|3|4|call=power v2|postfix=,3}} gives n.a.1n.a.164

Thus:

 ^|{{for|sep=,|2|3|call=x1}}<br>
 4|{{for|sep=,|2|3|call=power v2|prefix=4,}}<br>
 5|{{for|sep=,|2|3|call=power v2|prefix=5,}}

 ^|{{for|sep=,|{{t array 2|1}}|{{t array 2|2}}|call=x1}}<br>
 4|{{for|sep=,|{{t array 2|1}}|{{t array 2|2}}|call=power v2|prefix=4,}}<br>
 5|{{for|sep=,|{{t array 2|1}}|{{t array 2|2}}|call=power v2|prefix=5,}}

 ^|{{for|sep=,|{{t array 2|1}}|{{t array 2|2}}|call=x1}}<br>
{{array row 2|col=t array 2|arr=power v2|row=4}}
{{array row 2|col=t array 2|arr=power v2|row=5}}

  ^|{{for|sep=,|{{t array 2|1}}|{{t array 2|2}}|call=x1}}<br>
 {{fors|pv=row|4|5|pc1=col=t array 2|pc2=arr=power v2|call=array row 2}}

  ^|{{for|sep=,|{{t array 2|1}}|{{t array 2|2}}|call=x1}}<br>
 {{fors|pv=row|{{t array 1|1}}|{{t array 1|2}}|pc1=col=t array 2|pc2=arr=power v2|call=array row 2}}

using Template:t array 2 (talk, backlinks, edit) containing:


{{#switch:{{{1}}}|1=2|2=3}}


and

Template:array row 2 (talk, backlinks, edit) containing:


{{{row}}}|{{for|, |{{t array 2|1}}|{{t array 2|2}}|call=power|pc1n=1|pc1v={{{row}}}|pv=2}}<br>


gives


^|3
4|64
5|125

^|3
4|64
5|125

^|3
4|16, 64
5|25, 125

 ^|3
4|16, 64
5|25, 125

 ^|3
4|16, 64
5|25, 125

See also edit

History edit

Created
Patrick 21 December 2005 (UTC)

Discussion edit

Return to "Power v2" page.