+
1
|
list
|
skin
|
login
|
editor
α-wwwiki
::
newton
user:none
(1082 bytes)
_h1 newton _p Compute the square root of a number with the Newton method. {pre °°{define newton (i x) •• function newto (i,x) { return (i==1)? 1 : (newto(i-1,x) + x/newto(i-1,x))/2; } return newto(i,x); ••}°° -> {define newton (i x) °° function newto (i,x) { return (i==1)? 1 : (newto(i-1,x) + x/newto(i-1,x))/2; } return newto(i,x); °°} } _h3 the square root of 2 {pre 1 : {newton 1 2} 2 : {newton 2 2} 3 : {newton 3 2} 4 : {newton 4 2} 5 : {newton 5 2} 6 : {newton 6 2} 7 : {newton 7 2} // stabilized } _h3 the golden number (1+sqrt(5))/2 {pre 1 : {/ {+ 1 {newton 1 5}} 2} 2 : {/ {+ 1 {newton 2 5}} 2} 3 : {/ {+ 1 {newton 3 5}} 2} 4 : {/ {+ 1 {newton 4 5}} 2} 5 : {/ {+ 1 {newton 5 5}} 2} 6 : {/ {+ 1 {newton 6 5}} 2} 7 : {/ {+ 1 {newton 7 5}} 2} 8 : {/ {+ 1 {newton 8 5}} 2} } _p See also : _ul [[La-methode-de-Newton|http://images.math.cnrs.fr/La-methode-de-Newton-et-son.html]] _ul [[images.math.cnrs.fr/Cheritat-Arnaud|http://images.math.cnrs.fr/_Cheritat-Arnaud_.html]]