回答編集履歴
2
微修正
test
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
|
27
27
|
>>> b = 2
|
28
28
|
|
29
|
-
>>> while a*a -
|
29
|
+
>>> while a*a - b > 0.0001:
|
30
30
|
|
31
31
|
... a = (a + b/a)/2
|
32
32
|
|
1
追記
test
CHANGED
@@ -17,3 +17,25 @@
|
|
17
17
|
a = (a + b/a)/2
|
18
18
|
|
19
19
|
を繰り返せば a は √b = √2 に近づきます。
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
```
|
24
|
+
|
25
|
+
>>> a = 2
|
26
|
+
|
27
|
+
>>> b = 2
|
28
|
+
|
29
|
+
>>> while a*a - 2 > 0.0001:
|
30
|
+
|
31
|
+
... a = (a + b/a)/2
|
32
|
+
|
33
|
+
...
|
34
|
+
|
35
|
+
>>> a
|
36
|
+
|
37
|
+
1.4142156862745097
|
38
|
+
|
39
|
+
```
|
40
|
+
|
41
|
+
こんなカンジで。
|