Template talk:Tbl
Add topic{ |class="wikitable sortable" !#!!result { {subst:#if:1|{ {subst:tbl|square2|8|3}}}} | }
gives:
# | result |
---|---|
1 | Expression error: Unrecognised word "expression" |
2 | Expression error: Unrecognised word "expression" |
3 | Expression error: Unrecognised word "e" |
4 | 1.85302018885E+15 |
5 | 43046721 |
6 | 6561 |
7 | 81 |
8 | 9 |
{ |class="wikitable sortable" !#!!result { {subst:#if:1|{ {subst:tbl|double2|7|3}}}} | }
gives:
# | result |
---|---|
1 | 384 |
2 | 192 |
3 | 96 |
4 | 48 |
5 | 24 |
6 | 12 |
7 | 6 |
{ |class="wikitable sortable" !#!!result { {subst:#if:1|{ {subst:tbl|t2|7|abc}}}} | }
gives:
# | result |
---|---|
1 | start-1-middle-start-2-middle-start-3-middle-start-4-middle-start-5-middle-start-6-middle-start-7-middle-abc-end-end-end-end-end-end-end |
2 | start-2-middle-start-3-middle-start-4-middle-start-5-middle-start-6-middle-start-7-middle-abc-end-end-end-end-end-end |
3 | start-3-middle-start-4-middle-start-5-middle-start-6-middle-start-7-middle-abc-end-end-end-end-end |
4 | start-4-middle-start-5-middle-start-6-middle-start-7-middle-abc-end-end-end-end |
5 | start-5-middle-start-6-middle-start-7-middle-abc-end-end-end |
6 | start-6-middle-start-7-middle-abc-end-end |
7 | start-7-middle-abc-end |
Analysis of square root iteration[edit]
Take trivial case of sqr(1), to conveniently analyse how the error develops: first the error is approximately divided by two each time; when the approximation is about twice the true value the convergence gets very fast, only a few more steps are needed.
For finding the square root of e.g. 5 the same analysis applies: apart from rounding, after n steps the result is sqr(5) times the nth result of the previous iteration scheme with the starting value divided by sqr(5).
{ |class="wikitable sortable" !#!!result { {subst:#if:1|{ {subst:tbl|iteration step|50|1900000000000}}}} | }
gives:
# | result |
---|---|
1 | 1 |
2 | 1 |
3 | 1 |
4 | 1 |
5 | 1 |
6 | 1 |
7 | 1.00000001814 |
8 | 1.00019051057 |
9 | 1.01971120328 |
10 | 1.21923798866 |
11 | 1.91676309429 |
12 | 3.55199419711 |
13 | 6.96031677226 |
14 | 13.8484231572 |
15 | 27.6606939314 |
16 | 55.303305761 |
17 | 110.597569732 |
18 | 221.190618477 |
19 | 442.378976449 |
20 | 884.756822644 |
21 | 1769.51308016 |
22 | 3539.02587775 |
23 | 7078.05161422 |
24 | 14156.1031578 |
25 | 28312.2062803 |
26 | 56624.4125429 |
27 | 113248.825077 |
28 | 226497.650149 |
29 | 452995.300296 |
30 | 905990.60059 |
31 | 1811981.20118 |
32 | 3623962.40235 |
33 | 7247924.8047 |
34 | 14495849.6094 |
35 | 28991699.2188 |
36 | 57983398.4375 |
37 | 115966796.875 |
38 | 231933593.75 |
39 | 463867187.5 |
40 | 927734375 |
41 | 1855468750 |
42 | 3710937500 |
43 | 7421875000 |
44 | 14843750000 |
45 | 29687500000 |
46 | 59375000000 |
47 | 118750000000 |
48 | 237500000000 |
49 | 475000000000 |
50 | 950000000000 |
{ |class="wikitable sortable" !#!!result { {subst:#if:1|{ {subst:tbl|iteration step|5|2000000000000}}}} | }
gives:
# | result |
---|---|
1 | Expression error: Unrecognised word "expression" |
2 | Expression error: Unrecognised word "expression" |
3 | Expression error: Unrecognised word "expression" |
4 | Expression error: Unrecognised word "e" |
5 | 1E+12 |
{|class="wikitable sortable" !#!!result {{subst:#if:1|{{subst:tbl|square|7}}}} |}
# | result |
---|---|
1 | 1 |
2 | 4 |
3 | 9 |
4 | 16 |
5 | 25 |
6 | 36 |
7 | 49 |
Compare:
4 19 116 125 136 149
See also[edit]
General repetition templates:
- Template:Tbl - table output after call, hence in backward order
- Template:Tblb - table output before call, hence in forward order
- Template:Countdown - repetition of constant, counting down but displayed in backward order, so the numbering increases downward