Template talk:Square root

From Meta, a Wikimedia project coordination wiki

Jump to: navigation, search

This template reproduces a substitution call with an approximation of the square root of a number, producing one with a new approximation, and logging the result. Successively pressing edit/save gives convergence to plus or minus the square root, according to the sign of the starting value. The latter should not be zero.

{{subst:square root|5|-1}} gives successively (from bottom to top):
-2.2360679775
-2.2360679775
-2.2360679775
-2.23606889564
-2.2380952381
-2.33333333333
-3
-1


{{subst:square root|1024|1}} gives after multiple steps: {{subst:square root|1024|32}}
32
32
32
32.0000071648
32.021420905
33.1924874169
42.009585631
69.2273240544
130.61480157
257.24902439
512.5
1

{{subst:square root|3|1}} gives after multiple edit/save: {{subst:square root|3|1.73205080757}}
1.73205080757
1.73205080757
1.73205081001
1.73214285714
1.75
2
1

{{subst:square root|5|0}} gives after multiple edit/save:
Expression error: Unrecognised word "expression"
Expression error: Unrecognised word "expression"
Expression error: Unrecognised word "expression"
Expression error: Unrecognised word "division"
Division by zero
0

{{subst:#if:1|{{subst:#if:1|{{subst:#if:1|{{subst:#if:1|{{subst:#if:1|{{subst:#if:1|{{subst:square root|5|1}}}}}}}}}}}}}}

gives {{subst:square root|5|2.2360679775}}<br>2.2360679775<br>2.2360679775<br>2.23606889564<br>2.2380952381<br>2.33333333333<br>3<br>1

in one save.

{{subst:x10|{{subst:substif1}}}}{{subst:square root|5|1}}{{subst:x10|{{subst:rightbraces}}}} gives {{subst:square root|5|2.2360679775}}<br>2.2360679775<br>2.2360679775<br>2.2360679775<br>2.2360679775<br>2.2360679775<br>2.2360679775<br>2.2360679775<br>2.23606889564<br>2.2380952381<br>2.33333333333<br>3<br>1 in two saves.


[edit] Square root templates

See also: