can be the root of a number given by this formula
n x = (x-1 n + a / x n-1 ) / 2
It begins with a and x 0 equal to the number from which you want to pull the root set, and calculated 1 x . Then you calculate x 2 etc. differ until the two last values only low (eg, the difference is less Is 0.0000001).
Write a function
root (speed accuracy,) which calculated by the above method the root. Create a program
wurzel.py that prints a table of the roots of the numbers 1 to 20 at the accuracies 0.01, 0.0001 and 0.0000001: 1: 1.0000000 1.0000000 1.0000000
2:
1.4142157 1.4142136 1.4142136 3 1.7320508 1.7320508
1.7320508 4 2.0000001 2.0000000 2.0000000
5:
2.2360689 2.2360680 2.2360680 6 2.4494944 2.4494897 2.4494897
7:
2.6457670 2.6457513 2.6457513 8 2.8284271 2.8284271 2.8284271
9: 3.0000000 3.0000000 3.0000000
10: 3.1622777 3.1622777 3.1622777
11: 3.3166248 3.3166248 3.3166248
12: 3.4641017 3.4641016 3.4641016
13: 3.6055514 3.6055513 3.6055513
14: 3.7416576 3.7416574 3.7416574
15: 3.8729837 3.8729833 3.8729833
16: 4.0000006 4.0000000 4.0000000
17: 4.1231067 4.1231056 4.1231056
18: 4.2426425 4.2426407
4.2426407 19: 4.3589018 4.3588989 4.3588989
20: 4.4721402 4.4721360 4.4721360
0 comments:
Post a Comment