Forum de mathématiques - Bibm@th.net
Bienvenue dans les forums du site BibM@th, des forums où on dit Bonjour (Bonsoir), Merci, S'il vous plaît...
Vous n'êtes pas identifié(e).
- Contributions : Récentes | Sans réponse
Répondre
Résumé de la discussion (messages les plus récents en premier)
- yoshi
- 19-03-2012 20:48:50
Bonsoir,
J'ai choisi l'équation du 2nd degré x^2 - x - 1 = 0 dont la racine positive est le nombre d'or
[tex]\phi = \frac{1 + \sqrt 5}{2}\approx 1,6180339887...[/tex]
Pour la théorie, voir le dictionnaire de BibMath, ici : http://www.bibmath.net/dico/index.php?a … _meth.html.
1 VARIABLES
2 i EST_DU_TYPE NOMBRE
3 x EST_DU_TYPE NOMBRE
4 f EST_DU_TYPE NOMBRE
5 fp EST_DU_TYPE NOMBRE
6 DEBUT_ALGORITHME
7 AFFICHER " "
8 AFFICHER "*** Racine positive de x^2-x-1 = 0 ***"
9 AFFICHER " - Méthode de Newton -"
10 AFFICHER " "
11 x PREND_LA_VALEUR 1
12 POUR i ALLANT_DE 1 A 10
13 DEBUT_POUR
14 f PREND_LA_VALEUR pow(x,2)-x-1
15 fp PREND_LA_VALEUR 2*x-1
16 x PREND_LA_VALEUR x-f/fp
17 FIN_POUR
18 AFFICHER "Valeur de départ : x = 1"
19 AFFICHER "Valeur après 10 itérations : x = "
20 AFFICHER x
21 AFFICHER " "
22 FIN_ALGORITHME
Résultats :
***Algorithme lancé***
*** Racine positive de x^2 -x-1 = 0 ***
- Méthode de Newton -
Valeur de départ : x = 1
Valeur après 10 itérations : x = 1.618034
***Algorithme terminé***
2 i EST_DU_TYPE NOMBRE
3 x EST_DU_TYPE NOMBRE
4 f EST_DU_TYPE NOMBRE
5 fp EST_DU_TYPE NOMBRE
6 DEBUT_ALGORITHME
7 AFFICHER " "
8 AFFICHER "*** Racine positive de x^2-x-1 = 0 ***"
9 AFFICHER " - Méthode de Newton -"
10 AFFICHER " "
11 x PREND_LA_VALEUR 1
12 POUR i ALLANT_DE 1 A 10
13 DEBUT_POUR
14 f PREND_LA_VALEUR pow(x,2)-x-1
15 fp PREND_LA_VALEUR 2*x-1
16 x PREND_LA_VALEUR x-f/fp
17 FIN_POUR
18 AFFICHER "Valeur de départ : x = 1"
19 AFFICHER "Valeur après 10 itérations : x = "
20 AFFICHER x
21 AFFICHER " "
22 FIN_ALGORITHME
Résultats :
***Algorithme lancé***
*** Racine positive de x^2 -x-1 = 0 ***
- Méthode de Newton -
Valeur de départ : x = 1
Valeur après 10 itérations : x = 1.618034
***Algorithme terminé***
@+